Example usage for org.apache.lucene.document NumericDocValuesField TYPE

List of usage examples for org.apache.lucene.document NumericDocValuesField TYPE

Introduction

In this page you can find the example usage for org.apache.lucene.document NumericDocValuesField TYPE.

Prototype

FieldType TYPE

To view the source code for org.apache.lucene.document NumericDocValuesField TYPE.

Click Source Link

Document

Type for numeric DocValues.

Usage

From source file:org.meresco.lucene.DocumentStringToDocumentTest.java

License:Open Source License

@Test
public void testKeyField() {
    JsonArray json = Json.createArrayBuilder()
            .add(Json.createObjectBuilder().add("type", "KeyField").add("name", "name").add("value", "value"))
            .add(Json.createObjectBuilder().add("type", "KeyField").add("name", "name2").add("value", 153))
            .build();//  www.ja v a2 s . c o m
    Document result = convert(json.toString());
    assertEquals(NumericDocValuesField.TYPE, result.getField("name").fieldType());
    assertEquals(43, result.getField("name").numericValue().intValue());

    assertEquals(NumericDocValuesField.TYPE, result.getField("name2").fieldType());
    assertEquals(153, result.getField("name2").numericValue().intValue());
}

From source file:org.meresco.lucene.DocumentStringToDocumentTest.java

License:Open Source License

@Test
public void testNumericField() {
    JsonArray json = Json.createArrayBuilder()
            .add(Json.createObjectBuilder().add("type", "NumericField").add("name", "name").add("value", 1))
            .build();//from   w  w w.j  a  va 2  s  .  co m
    Document result = convert(json.toString());
    assertEquals(NumericDocValuesField.TYPE, result.getField("name").fieldType());
    assertEquals(1, result.getField("name").numericValue().doubleValue(), 0);
}