Example usage for org.apache.lucene.document FieldType setDocValuesType

List of usage examples for org.apache.lucene.document FieldType setDocValuesType

Introduction

In this page you can find the example usage for org.apache.lucene.document FieldType setDocValuesType.

Prototype

public void setDocValuesType(DocValuesType type) 

Source Link

Document

Sets the field's DocValuesType

Usage

From source file:com.epam.catgenome.dao.index.FeatureIndexDao.java

License:Open Source License

private void addCommonDocumentFields(Document document, FeatureIndexEntry entry, final Long featureFileId) {
    document.add(new SortedStringField(FeatureIndexFields.FEATURE_ID.getFieldName(), entry.getFeatureId()));

    FieldType fieldType = new FieldType();
    fieldType.setOmitNorms(true);/* w w  w  .jav a2 s. c  o m*/
    fieldType.setIndexOptions(IndexOptions.DOCS);
    fieldType.setStored(true);
    fieldType.setTokenized(false);
    fieldType.setDocValuesType(DocValuesType.SORTED);
    fieldType.freeze();
    Field field = new Field(FeatureIndexFields.CHROMOSOME_ID.getFieldName(),
            entry.getChromosome() != null ? new BytesRef(entry.getChromosome().getId().toString())
                    : new BytesRef(""),
            fieldType);
    document.add(field);
    document.add(new SortedStringField(FeatureIndexFields.CHROMOSOME_NAME.getFieldName(),
            entry.getChromosome().getName(), true));

    document.add(new SortedIntPoint(FeatureIndexFields.START_INDEX.getFieldName(), entry.getStartIndex()));
    document.add(new StoredField(FeatureIndexFields.START_INDEX.getFieldName(), entry.getStartIndex()));
    document.add(new SortedDocValuesField(FeatureIndexFields.START_INDEX.getGroupName(),
            new BytesRef(entry.getStartIndex().toString())));

    document.add(new SortedIntPoint(FeatureIndexFields.END_INDEX.getFieldName(), entry.getEndIndex()));
    document.add(new StoredField(FeatureIndexFields.END_INDEX.getFieldName(), entry.getEndIndex()));
    document.add(new SortedDocValuesField(FeatureIndexFields.END_INDEX.getGroupName(),
            new BytesRef(entry.getStartIndex().toString())));

    document.add(new StringField(FeatureIndexFields.FEATURE_TYPE.getFieldName(),
            entry.getFeatureType() != null ? entry.getFeatureType().getFileValue() : "", Field.Store.YES));
    document.add(new StringField(FeatureIndexFields.FILE_ID.getFieldName(), featureFileId.toString(),
            Field.Store.YES));

    document.add(new StringField(FeatureIndexFields.FEATURE_NAME.getFieldName(),
            entry.getFeatureName() != null ? entry.getFeatureName().toLowerCase() : "", Field.Store.YES));
    document.add(new SortedDocValuesField(FeatureIndexFields.FEATURE_NAME.getFieldName(),
            new BytesRef(entry.getFeatureName() != null ? entry.getFeatureName() : "")));

    document.add(new SortedSetDocValuesFacetField(FeatureIndexFields.CHR_ID.getFieldName(),
            entry.getChromosome().getId().toString()));

    document.add(new SortedStringField(FeatureIndexFields.UID.getFieldName(), entry.getUuid().toString()));
    document.add(new SortedSetDocValuesFacetField(FeatureIndexFields.F_UID.getFieldName(),
            entry.getUuid().toString()));
}

From source file:com.qwazr.search.field.CustomFieldType.java

License:Apache License

@Override
final public void fillValue(final Object value, final FieldConsumer consumer) {
    final FieldType type = new FieldType();
    if (fieldDef.stored != null)
        type.setStored(fieldDef.stored);
    if (fieldDef.tokenized != null)
        type.setTokenized(fieldDef.tokenized);
    if (fieldDef.store_termvectors != null)
        type.setStoreTermVectors(fieldDef.store_termvectors);
    if (fieldDef.store_termvector_offsets != null)
        type.setStoreTermVectorOffsets(fieldDef.store_termvector_offsets);
    if (fieldDef.store_termvector_positions != null)
        type.setStoreTermVectorPositions(fieldDef.store_termvector_positions);
    if (fieldDef.store_termvector_payloads != null)
        type.setStoreTermVectorPayloads(fieldDef.store_termvector_payloads);
    if (fieldDef.omit_norms != null)
        type.setOmitNorms(fieldDef.omit_norms);
    if (fieldDef.numeric_type != null)
        type.setNumericType(fieldDef.numeric_type);
    if (fieldDef.index_options != null)
        type.setIndexOptions(fieldDef.index_options);
    if (fieldDef.docvalues_type != null)
        type.setDocValuesType(fieldDef.docvalues_type);
    consumer.accept(new CustomField(fieldName, type, value));
}

From source file:com.vmware.dcp.services.common.LuceneDocumentIndexService.java

License:Open Source License

public static FieldType numericDocType(FieldType.NumericType type, boolean store) {
    FieldType t = new FieldType();
    t.setStored(store);/*from  w w w .  ja  va2s  .c om*/
    t.setDocValuesType(DocValuesType.NUMERIC);
    t.setIndexOptions(IndexOptions.DOCS);
    t.setNumericType(type);
    return t;
}

From source file:org.hibernate.search.spatial.impl.SpatialNumericDocValueField.java

License:LGPL

private static FieldType createSpatialFieldType() {
    FieldType type = new FieldType();
    type.setIndexOptions(IndexOptions.NONE);
    type.setDocValuesType(DocValuesType.NUMERIC);
    type.freeze();/*from  ww w.j a  v a  2s .  c om*/
    return type;
}

From source file:org.languagetool.dev.bigdata.AggregatedNgramToLucene.java

License:Open Source License

@NotNull
private LongField getCountField(long count) {
    FieldType fieldType = new FieldType();
    fieldType.setStored(true);/*from w w  w  . j a v a 2  s.co  m*/
    fieldType.setOmitNorms(true);
    fieldType.setNumericType(FieldType.NumericType.LONG);
    fieldType.setDocValuesType(DocValuesType.NUMERIC);
    return new LongField("count", count, fieldType);
}

From source file:org.wso2.carbon.analytics.dataservice.core.indexing.AnalyticsDataIndexer.java

License:Open Source License

private FieldType getLuceneNumericFieldType(FieldType.NumericType type) {
    FieldType fieldType = new FieldType();
    fieldType.setStored(false);/*w  ww .jav  a2s  .c o m*/
    fieldType.setDocValuesType(DocValuesType.NUMERIC);
    fieldType.setTokenized(true);
    fieldType.setOmitNorms(true);
    fieldType.setIndexOptions(IndexOptions.DOCS);
    fieldType.setNumericType(type);
    if (type == FieldType.NumericType.FLOAT || type == FieldType.NumericType.INT) {
        fieldType.setNumericPrecisionStep(NumericUtils.PRECISION_STEP_DEFAULT_32);
    }
    fieldType.freeze();
    return fieldType;
}

From source file:tw.com.kyle.luminance.FieldTypeFactory.java

private static FieldType getTimestampFieldType() {
    FieldType raw_ft = new FieldType();
    raw_ft.setStored(true);/*ww w .j a va  2 s  .c om*/
    raw_ft.setDocValuesType(DocValuesType.SORTED);
    raw_ft.freeze();
    return raw_ft;
}