Examples of numericValue()


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

        assertEquals(1, hits.length);
        // Iterate through the results:
        for (int i = 0; i < hits.length; i++) {
            Document hitDoc = isearcher.doc(hits[i].doc);
            IndexableField field = hitDoc.getField("intfield");
            assertEquals(4, field.numericValue().intValue());
        }
           
    }
   
    private Query createTermQuery(String expression) throws Exception {
View Full Code Here

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

    @Override
    public Object get(String name, Document document) {
      final IndexableField field = document.getField( name );
      if ( field != null ) {
        Number numericValue = field.numericValue();
        BigDecimal bigValue = new BigDecimal( numericValue.longValue() );
        return bigValue.divide( storeFactor );
      }
      else {
        return null;
View Full Code Here

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

        assertEquals(1, hits.length);
        // Iterate through the results:
        for (int i = 0; i < hits.length; i++) {
            Document hitDoc = isearcher.doc(hits[i].doc);
            IndexableField field = hitDoc.getField("intfield");
            assertEquals(4, field.numericValue().intValue());
        }
           
    }
   
    protected Query createTermQuery(String expression) throws Exception {
View Full Code Here

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);
      assertTrue(inputIterator.payload().equals(doc.getField(PAYLOAD_FIELD_NAME).binaryValue()));
    }
   
    for (String invalidTerm : invalidDocTerms) {
      assertNotNull(docs.remove(invalidTerm));
View Full Code Here

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

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);
      assertTrue(inputIterator.payload().equals(doc.getField(PAYLOAD_FIELD_NAME).binaryValue()));
      Set<BytesRef> oriCtxs = new HashSet<>();
      Set<BytesRef> contextSet = inputIterator.contexts();
      for (IndexableField ctxf : doc.getFields(CONTEXT_FIELD_NAME)) {
        oriCtxs.add(ctxf.binaryValue());
View Full Code Here

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

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

     * 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

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

     * 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

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

                                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
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.