Examples of numericValue()


Examples of org.apache.lucene.document.Field.numericValue()

      final FieldCache.Ints ids = FieldCache.DEFAULT.getInts(sub, "id", false);
      for(int docID=0;docID<sub.numDocs();docID++) {
        final Document doc = sub.document(docID);
        final Field f = (Field) doc.getField("nf");
        assertTrue("got f=" + f, f instanceof StoredField);
        assertEquals(answers[ids.get(docID)], f.numericValue());
      }
    }
    r.close();
    dir.close();
  }
View Full Code Here

Examples of org.apache.lucene.document.Field.numericValue()

    public void testField()
    {
        ColumnMapperFloat mapper = new ColumnMapperFloat(1f);
        Field field = mapper.field("name", "3.2");
        Assert.assertNotNull(field);
        Assert.assertEquals(Float.valueOf(3.2f), field.numericValue());
        Assert.assertEquals("name", field.name());
        Assert.assertEquals(false, field.fieldType().stored());
    }

    @Test
View Full Code Here

Examples of org.apache.lucene.document.Field.numericValue()

    public void testField() throws ParseException
    {
        ColumnMapperDate mapper = new ColumnMapperDate(PATTERN);
        Field field = mapper.field("name", "2014-03-19");
        Assert.assertNotNull(field);
        Assert.assertEquals(sdf.parse("2014-03-19").getTime(), field.numericValue().longValue());
        Assert.assertEquals("name", field.name());
        Assert.assertEquals(false, field.fieldType().stored());
    }

    @Test
View Full Code Here

Examples of org.apache.lucene.document.Field.numericValue()

    public void testField()
    {
        ColumnMapperLong mapper = new ColumnMapperLong(1f);
        Field field = mapper.field("name", "3.2");
        Assert.assertNotNull(field);
        Assert.assertEquals(Long.valueOf(3), field.numericValue());
        Assert.assertEquals("name", field.name());
        Assert.assertEquals(false, field.fieldType().stored());
    }

    @Test
View Full Code Here

Examples of org.apache.lucene.document.Field.numericValue()

    public void testField()
    {
        ColumnMapperDouble mapper = new ColumnMapperDouble(1f);
        Field field = mapper.field("name", "3.2");
        Assert.assertNotNull(field);
        Assert.assertEquals(Double.valueOf(3.2d), field.numericValue());
        Assert.assertEquals("name", field.name());
        Assert.assertEquals(false, field.fieldType().stored());
    }

    @Test
View Full Code Here

Examples of org.apache.lucene.document.Field.numericValue()

    public void testField()
    {
        ColumnMapperInteger mapper = new ColumnMapperInteger(1f);
        Field field = mapper.field("name", "3.2");
        Assert.assertNotNull(field);
        Assert.assertEquals(Integer.valueOf(3), field.numericValue());
        Assert.assertEquals("name", field.name());
        Assert.assertEquals(false, field.fieldType().stored());
    }

    @Test
View Full Code Here

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

                    continue;
                }
                String matchedName = INDEX_NAME.getValue(doc);
                if (!geoname.isAncestryResolved()) {
                    IndexableField parentIdField = doc.getField(IndexField.PARENT_ID.key());
                    Integer parentId = parentIdField != null && parentIdField.numericValue() != null ?
                            parentIdField.numericValue().intValue() : null;
                    if (parentId != null) {
                        Set<GeoName> geos = parentMap.get(parentId);
                        if (geos == null) {
                            geos = new HashSet<GeoName>();
View Full Code Here

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

                }
                String matchedName = INDEX_NAME.getValue(doc);
                if (!geoname.isAncestryResolved()) {
                    IndexableField parentIdField = doc.getField(IndexField.PARENT_ID.key());
                    Integer parentId = parentIdField != null && parentIdField.numericValue() != null ?
                            parentIdField.numericValue().intValue() : null;
                    if (parentId != null) {
                        Set<GeoName> geos = parentMap.get(parentId);
                        if (geos == null) {
                            geos = new HashSet<GeoName>();
                            parentMap.put(parentId, geos);
View Full Code Here

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

    /** Return the suggestion weight for this document */
    protected long getWeight(int docId) {
      IndexableField weight = doc.getField(weightField);
      if (weight == null) {
        throw new IllegalArgumentException(weightField + " does not exist");
      } else if (weight.numericValue() == null) {
        throw new IllegalArgumentException(weightField + " does not have numeric value");
      }
      return weight.numericValue().longValue();
    }
   
View Full Code Here

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

      if (weight == null) {
        throw new IllegalArgumentException(weightField + " does not exist");
      } else if (weight.numericValue() == null) {
        throw new IllegalArgumentException(weightField + " does not have numeric value");
      }
      return weight.numericValue().longValue();
    }
   
    private Set<String> getRelevantFields(String... fields) {
      Set<String> relevantFields = new HashSet<String>();
      for (String relevantField : fields) {
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.