Examples of numericValue()


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);
      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()

      DirectoryReader reader = DirectoryReader.open(directory);
      int numDocs = reader.numDocs();
      for (int d = 0; d < numDocs; d++) {
        Document document = reader.document(d);
        IndexableField field = document.getField("id");
        Integer id = (Integer) field.numericValue();
        int partition = partitioner.getPartition(new IntWritable(id), null, totalShardCount);
        assertEquals(i, partition);
      }
      reader.close();
    }
View Full Code Here

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

      DirectoryReader reader = DirectoryReader.open(directory);
      int numDocs = reader.numDocs();
      for (int d = 0; d < numDocs; d++) {
        Document document = reader.document(d);
        IndexableField field = document.getField("id");
        Integer id = (Integer) field.numericValue();
        int partition = partitioner.getPartition(new IntWritable(id), null, totalShardCount);
        assertEquals(i, partition);
      }
      reader.close();
    }
View Full Code Here

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

            return null;
        }
        else
        {
            _wasNull = false;
            Number  number = field.numericValue();

            return number;
        }
    }
View Full Code Here

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

      final IndexableField sField = sDoc.getField(fldName);
      if (Field.class.equals(fld.getClass())) {
        assertEquals(fld.binaryValue(), sField.binaryValue());
        assertEquals(fld.stringValue(), sField.stringValue());
      } else {
        assertEquals(fld.numericValue(), sField.numericValue());
      }
    }
    reader.close();
  }
View Full Code Here

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

                }
                //load the rankings
                if(rankingField != null){
                    IndexableField field = doc.getField(rankingField);
                    if(field != null) {
                        Number num = field.numericValue();
                        Double ranking;
                        if(num instanceof Double){
                            ranking = (Double)num;
                        } else if (num != null){
                            ranking = Double.valueOf(num.doubleValue());
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.