当前位置: 首页>>代码示例>>Java>>正文


Java IndexableFieldType类代码示例

本文整理汇总了Java中org.apache.lucene.index.IndexableFieldType的典型用法代码示例。如果您正苦于以下问题:Java IndexableFieldType类的具体用法?Java IndexableFieldType怎么用?Java IndexableFieldType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IndexableFieldType类属于org.apache.lucene.index包,在下文中一共展示了IndexableFieldType类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fieldType

import org.apache.lucene.index.IndexableFieldType; //导入依赖的package包/类
@Override
public IndexableFieldType fieldType() {
    return TYPE;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:5,代码来源:NumberFieldMapper.java

示例2: testTextFieldWithTermVectors

import org.apache.lucene.index.IndexableFieldType; //导入依赖的package包/类
@Test
public void testTextFieldWithTermVectors() {
    JsonArray json = Json.createArrayBuilder()
            .add(Json.createObjectBuilder()
                .add("type", "TextField")
                .add("termVectors", JsonValue.TRUE)
                .add("name", "name")
                .add("value", "value"))
            .build();
    Document result = convert(json.toString());
    IndexableFieldType fieldType = result.getField("name").fieldType();
    assertTrue(fieldType.storeTermVectors());
    assertEquals("value", result.getField("name").stringValue());
}
 
开发者ID:seecr,项目名称:meresco-lucene,代码行数:15,代码来源:DocumentStringToDocumentTest.java

示例3: testDefaults

import org.apache.lucene.index.IndexableFieldType; //导入依赖的package包/类
public void testDefaults() throws Exception {
    String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
            .startObject("properties").startObject("field").field("type", "keyword").endObject().endObject()
            .endObject().endObject().string();

    DocumentMapper mapper = parser.parse("type", new CompressedXContent(mapping));

    assertEquals(mapping, mapper.mappingSource().toString());

    ParsedDocument doc = mapper.parse("test", "type", "1", XContentFactory.jsonBuilder()
            .startObject()
            .field("field", "1234")
            .endObject()
            .bytes());

    IndexableField[] fields = doc.rootDoc().getFields("field");
    assertEquals(2, fields.length);

    assertEquals(new BytesRef("1234"), fields[0].binaryValue());
    IndexableFieldType fieldType = fields[0].fieldType();
    assertThat(fieldType.omitNorms(), equalTo(true));
    assertFalse(fieldType.tokenized());
    assertFalse(fieldType.stored());
    assertThat(fieldType.indexOptions(), equalTo(IndexOptions.DOCS));
    assertThat(fieldType.storeTermVectors(), equalTo(false));
    assertThat(fieldType.storeTermVectorOffsets(), equalTo(false));
    assertThat(fieldType.storeTermVectorPositions(), equalTo(false));
    assertThat(fieldType.storeTermVectorPayloads(), equalTo(false));
    assertEquals(DocValuesType.NONE, fieldType.docValuesType());

    assertEquals(new BytesRef("1234"), fields[1].binaryValue());
    fieldType = fields[1].fieldType();
    assertThat(fieldType.indexOptions(), equalTo(IndexOptions.NONE));
    assertEquals(DocValuesType.SORTED_SET, fieldType.docValuesType());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:36,代码来源:KeywordFieldMapperTests.java

示例4: testNormalizer

import org.apache.lucene.index.IndexableFieldType; //导入依赖的package包/类
public void testNormalizer() throws IOException {
    String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
            .startObject("properties").startObject("field")
            .field("type", "keyword").field("normalizer", "my_lowercase").endObject().endObject()
            .endObject().endObject().string();

    DocumentMapper mapper = parser.parse("type", new CompressedXContent(mapping));

    assertEquals(mapping, mapper.mappingSource().toString());

    ParsedDocument doc = mapper.parse("test", "type", "1", XContentFactory.jsonBuilder()
            .startObject()
            .field("field", "AbC")
            .endObject()
            .bytes());

    IndexableField[] fields = doc.rootDoc().getFields("field");
    assertEquals(2, fields.length);

    assertEquals(new BytesRef("abc"), fields[0].binaryValue());
    IndexableFieldType fieldType = fields[0].fieldType();
    assertThat(fieldType.omitNorms(), equalTo(true));
    assertFalse(fieldType.tokenized());
    assertFalse(fieldType.stored());
    assertThat(fieldType.indexOptions(), equalTo(IndexOptions.DOCS));
    assertThat(fieldType.storeTermVectors(), equalTo(false));
    assertThat(fieldType.storeTermVectorOffsets(), equalTo(false));
    assertThat(fieldType.storeTermVectorPositions(), equalTo(false));
    assertThat(fieldType.storeTermVectorPayloads(), equalTo(false));
    assertEquals(DocValuesType.NONE, fieldType.docValuesType());

    assertEquals(new BytesRef("abc"), fields[1].binaryValue());
    fieldType = fields[1].fieldType();
    assertThat(fieldType.indexOptions(), equalTo(IndexOptions.NONE));
    assertEquals(DocValuesType.SORTED_SET, fieldType.docValuesType());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:37,代码来源:KeywordFieldMapperTests.java

示例5: testDefaults

import org.apache.lucene.index.IndexableFieldType; //导入依赖的package包/类
public void testDefaults() throws Exception {
    String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
            .startObject("properties").startObject("field").field("type", "text").endObject().endObject()
            .endObject().endObject().string();

    DocumentMapper mapper = parser.parse("type", new CompressedXContent(mapping));

    assertEquals(mapping, mapper.mappingSource().toString());

    ParsedDocument doc = mapper.parse("test", "type", "1", XContentFactory.jsonBuilder()
            .startObject()
            .field("field", "1234")
            .endObject()
            .bytes());

    IndexableField[] fields = doc.rootDoc().getFields("field");
    assertEquals(1, fields.length);

    assertEquals("1234", fields[0].stringValue());
    IndexableFieldType fieldType = fields[0].fieldType();
    assertThat(fieldType.omitNorms(), equalTo(false));
    assertTrue(fieldType.tokenized());
    assertFalse(fieldType.stored());
    assertThat(fieldType.indexOptions(), equalTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS));
    assertThat(fieldType.storeTermVectors(), equalTo(false));
    assertThat(fieldType.storeTermVectorOffsets(), equalTo(false));
    assertThat(fieldType.storeTermVectorPositions(), equalTo(false));
    assertThat(fieldType.storeTermVectorPayloads(), equalTo(false));
    assertEquals(DocValuesType.NONE, fieldType.docValuesType());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:31,代码来源:TextFieldMapperTests.java

示例6: fieldType

import org.apache.lucene.index.IndexableFieldType; //导入依赖的package包/类
@Override
public IndexableFieldType fieldType() {
  return getRealValue().fieldType();
}
 
开发者ID:europeana,项目名称:search,代码行数:5,代码来源:LazyDocument.java

示例7: from

import org.apache.lucene.index.IndexableFieldType; //导入依赖的package包/类
public static FieldType from(IndexableFieldType indexableFieldType) {
    final FieldType fieldType = new FieldType();
    fieldType.setStored(indexableFieldType.stored());
    fieldType.setIndexed(indexableFieldType.indexed());
    fieldType.setIndexOptions(indexableFieldType.indexOptions());
    fieldType.setStoreTermVectors(indexableFieldType.storeTermVectors());
    fieldType.setStoreTermVectorPositions(indexableFieldType.storeTermVectorPositions());
    fieldType.setStoreTermVectorPayloads(indexableFieldType.storeTermVectorPayloads());
    fieldType.setStoreTermVectorOffsets(indexableFieldType.storeTermVectorOffsets());
    fieldType.setDocValueType(indexableFieldType.docValueType());
    fieldType.setOmitNorms(indexableFieldType.omitNorms());
    fieldType.setTokenized(indexableFieldType.tokenized());
    return fieldType;
}
 
开发者ID:roshanp,项目名称:lucure-core,代码行数:15,代码来源:IndexableFieldUtils.java

示例8: ObjectField

import org.apache.lucene.index.IndexableFieldType; //导入依赖的package包/类
private ObjectField(String name, Object object, IndexableFieldType type, float boost) {
  this.name = name;
  this.object = object;
  this.type = type;
  this.boost = boost;
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:7,代码来源:MergeAbstractFieldType.java

示例9: fieldType

import org.apache.lucene.index.IndexableFieldType; //导入依赖的package包/类
@Override
public IndexableFieldType fieldType() {
  return type;
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:5,代码来源:MergeAbstractFieldType.java

示例10: testTextField

import org.apache.lucene.index.IndexableFieldType; //导入依赖的package包/类
@Test
public void testTextField() {
    JsonArray json = Json.createArrayBuilder()
            .add(Json.createObjectBuilder()
                .add("type", "TextField")
                .add("name", "name")
                .add("value", "value"))
            .build();
    Document result = convert(json.toString());
    IndexableFieldType fieldType = result.getField("name").fieldType();
    assertEquals(TextField.TYPE_NOT_STORED, fieldType);
    assertFalse(fieldType.storeTermVectors());
    assertEquals("value", result.getField("name").stringValue());
}
 
开发者ID:seecr,项目名称:meresco-lucene,代码行数:15,代码来源:DocumentStringToDocumentTest.java


注:本文中的org.apache.lucene.index.IndexableFieldType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。