Example usage for org.apache.lucene.index DocValuesType SORTED

List of usage examples for org.apache.lucene.index DocValuesType SORTED

Introduction

In this page you can find the example usage for org.apache.lucene.index DocValuesType SORTED.

Prototype

DocValuesType SORTED

To view the source code for org.apache.lucene.index DocValuesType SORTED.

Click Source Link

Document

A pre-sorted byte[].

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);/*from   w  ww .  j  a v  a 2 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.stratio.cassandra.lucene.schema.mapping.BigDecimalMapperTest.java

License:Apache License

@Test
public void testSortedField() {
    BigDecimalMapper mapper = new BigDecimalMapper("field", false, null, 4, 4);
    String base = mapper.base("name", "42.43");
    Field field = mapper.sortedField("name", base, false);
    assertNotNull(field);/*from  w  ww  . ja v a  2s  .  c om*/
    assertEquals(DocValuesType.SORTED, field.fieldType().docValuesType());
}

From source file:com.stratio.cassandra.lucene.schema.mapping.BigIntegerMapperTest.java

License:Apache License

@Test
public void testSortedField() {
    BigIntegerMapper mapper = new BigIntegerMapper("field", null, true, 10);
    String base = mapper.base("name", "4243");
    Field field = mapper.sortedField("name", base, false);
    assertNotNull(field);//from  w w w.j  a  v  a  2s  .  c  o  m
    assertEquals(DocValuesType.SORTED, field.fieldType().docValuesType());
}

From source file:com.stratio.cassandra.lucene.schema.mapping.BlobMapperTest.java

License:Apache License

@Test
public void testSortedField() {
    BlobMapper mapper = new BlobMapper("field", true, false);
    String base = mapper.base("name", "f1B2");
    Field field = mapper.sortedField("name", base, false);
    assertNotNull(field);/*from   w  w w  .j  av a  2 s .  com*/
    assertEquals(DocValuesType.SORTED, field.fieldType().docValuesType());
}

From source file:com.stratio.cassandra.lucene.schema.mapping.BooleanMapperTest.java

License:Apache License

@Test
public void testSortedField() {
    BooleanMapper mapper = new BooleanMapper("field", true, false);
    Field field = mapper.sortedField("name", "true", false);
    assertNotNull(field);/*from w  w w . ja v  a2s. c  o m*/
    assertEquals(DocValuesType.SORTED, field.fieldType().docValuesType());
}

From source file:com.stratio.cassandra.lucene.schema.mapping.InetMapperTest.java

License:Apache License

@Test
public void testSortedField() {
    InetMapper mapper = new InetMapper("field", true, true);
    Field field = mapper.sortedField("name", "192.168.0.13", false);
    assertNotNull(field);//from w w  w  .j  a  v a 2  s . c  o m
    assertEquals(DocValuesType.SORTED, field.fieldType().docValuesType());
}

From source file:com.stratio.cassandra.lucene.schema.mapping.StringMapperTest.java

License:Apache License

@Test
public void testSortedField() {
    StringMapper mapper = new StringMapper("field", true, true, true);
    Field field = mapper.sortedField("name", "hello", false);
    assertNotNull(field);//from  w  w w . j a va 2  s.  co  m
    assertEquals(DocValuesType.SORTED, field.fieldType().docValuesType());
}

From source file:com.stratio.cassandra.lucene.schema.mapping.TextMapperTest.java

License:Apache License

@Test
public void testSortedField() {
    TextMapper mapper = new TextMapper("field", null, true, "org.apache.lucene.analysis.en.EnglishAnalyzer");
    Field field = mapper.sortedField("name", "hello", false);
    assertNotNull(field);/*from w ww .  java  2s  .  c  o  m*/
    assertEquals(DocValuesType.SORTED, field.fieldType().docValuesType());
}

From source file:com.stratio.cassandra.lucene.schema.mapping.UUIDMapperTest.java

License:Apache License

@Test
public void testSortedField() {
    UUIDMapper mapper = new UUIDMapper("field", true, true);
    String base = mapper.base("name", "550e8400-e29b-41d4-a716-446655440000");
    Field field = mapper.sortedField("name", base, false);
    assertNotNull(field);// w  w w  . j  a  v a2 s .  c  om
    assertEquals(DocValuesType.SORTED, field.fieldType().docValuesType());
}

From source file:com.vmware.xenon.services.common.Lucene60FieldInfosFormatWithCache.java

License:Open Source License

private static DocValuesType getDocValuesType(IndexInput input, byte b) throws IOException {
    switch (b) {/*from w  w w  .j  a  va 2s.c  om*/
    case 0:
        return DocValuesType.NONE;
    case 1:
        return DocValuesType.NUMERIC;
    case 2:
        return DocValuesType.BINARY;
    case 3:
        return DocValuesType.SORTED;
    case 4:
        return DocValuesType.SORTED_SET;
    case 5:
        return DocValuesType.SORTED_NUMERIC;
    default:
        throw new CorruptIndexException("invalid docvalues byte: " + b, input);
    }
}