Package org.apache.lucene.index

Examples of org.apache.lucene.index.IndexableField.numericValue()


    BytesRef f;
    while((f = inputIterator.next())!=null) {
      Document doc = docs.remove(f.utf8ToString());
      assertTrue(f.equals(new BytesRef(doc.get(FIELD_NAME))));
      IndexableField weightField = doc.getField(WEIGHT_FIELD_NAME);
      assertEquals(inputIterator.weight(), (weightField != null) ? weightField.numericValue().longValue() : 0);
      assertEquals(inputIterator.payload(), null);
    }
   
    for (String invalidTerm : invalidDocTerms) {
      assertNotNull(docs.remove(invalidTerm));
View Full Code Here


     * If no value is found, then the weight is 0.
     */
    protected long getWeight(Document doc, int docId) {
      IndexableField weight = doc.getField(weightField);
      if (weight != null) { // found weight as stored
        return (weight.numericValue() != null) ? weight.numericValue().longValue() : 0;
      } else if (weightValues != null) {  // found weight as NumericDocValue
        return weightValues.get(docId);
      } else { // fall back
        return 0;
      }
View Full Code Here

     * If no value is found, then the weight is 0.
     */
    protected long getWeight(Document doc, int docId) {
      IndexableField weight = doc.getField(weightField);
      if (weight != null) { // found weight as stored
        return (weight.numericValue() != null) ? weight.numericValue().longValue() : 0;
      } else if (weightValues != null) {  // found weight as NumericDocValue
        return weightValues.get(docId);
      } else { // fall back
        return 0;
      }
View Full Code Here

                                IndexableField lonField = lonFields[i];
                                IndexableField latField = latFields[i];
                                assert lonField.fieldType().docValueType() == latField.fieldType().docValueType();
                                // we write doc values fields differently: one field for all values, so we need to only care about indexed fields
                                if (lonField.fieldType().docValueType() == DocValuesType.NONE) {
                                    spare.reset(latField.numericValue().doubleValue(), lonField.numericValue().doubleValue());
                                    geohashes.add(spare.geohash());
                                }
                            }
                        } else {
                            geohashes = mapping.defaultLocations;
View Full Code Here

        assertThat(docMapper.mappers().fullName("name.not_indexed").mapper().fieldType().tokenized(), equalTo(true));

        assertNull(doc.getField("age"));
        f = doc.getField("age.not_stored");
        assertThat(f.name(), equalTo("age.not_stored"));
        assertThat(f.numericValue(), equalTo((Number) 28L));
        assertThat(f.fieldType().stored(), equalTo(false));
        assertNotSame(IndexOptions.NONE, f.fieldType().indexOptions());

        f = doc.getField("age.stored");
        assertThat(f.name(), equalTo("age.stored"));
View Full Code Here

        assertThat(f.fieldType().stored(), equalTo(false));
        assertNotSame(IndexOptions.NONE, f.fieldType().indexOptions());

        f = doc.getField("age.stored");
        assertThat(f.name(), equalTo("age.stored"));
        assertThat(f.numericValue(), equalTo((Number) 28L));
        assertThat(f.fieldType().stored(), equalTo(true));
        assertNotSame(IndexOptions.NONE, f.fieldType().indexOptions());

        assertThat(docMapper.mappers().fullName("age").mapper(), notNullValue());
        assertThat(docMapper.mappers().fullName("age").mapper(), instanceOf(LongFieldMapper.class));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.