Package org.apache.lucene.document

Examples of org.apache.lucene.document.DoubleField


    doc.add( field );
    field = new Field( "id", "1", Field.Store.YES, Field.Index.NOT_ANALYZED );
    doc.add( field );
    field = new Field( "logo", shirt.getLogo(), Field.Store.NO, Field.Index.ANALYZED );
    doc.add( field );
    DoubleField numField = new DoubleField( "length", shirt.getLength(), Field.Store.NO );
    doc.add( numField );
    LuceneWork luceneWork = new AddLuceneWork(
        shirt.getId(), String.valueOf( shirt.getId() ), shirt.getClass(), doc
    );
    List<LuceneWork> queue = new ArrayList<LuceneWork>();
View Full Code Here


    getLuceneDocument().add( numField );
  }

  @Override
  public void addDoubleNumericField(double value, String name, int precisionStep, SerializableStore store, boolean indexed, float boost, boolean omitNorms, boolean omitTermFreqAndPositions) {
    final DoubleField numField = new DoubleField( name, value, getStore( store ) );
    numField.setBoost( boost );
    getLuceneDocument().add( numField );
  }
View Full Code Here

            RemoteEntity.class
        )
    );

    Document doc = new Document();
    Field numField = new DoubleField( "double", 23d, Store.NO );
    //numField.setBoost( 3f );
    //numField.setOmitNorms( true );
    //numField.setOmitTermFreqAndPositions( true );
    doc.add( numField );
    numField = new IntField( "int", 23, Store.NO );
View Full Code Here

            RemoteEntity.class
        )
    );

    Document doc = new Document();
    Field numField = new DoubleField( "double", 23d, Store.NO );
    doc.add( numField );
    numField = new IntField( "int", 23, Store.NO );
    doc.add( numField );
    numField = new FloatField( "float", 2.3f, Store.NO );
    doc.add( numField );
View Full Code Here

    doc.add( field );
    field = new Field( "id", "1", Field.Store.YES, Field.Index.NOT_ANALYZED );
    doc.add( field );
    field = new Field( "logo", shirt.getLogo(), Field.Store.NO, Field.Index.ANALYZED );
    doc.add( field );
    DoubleField numField = new DoubleField( "length", shirt.getLength(), Field.Store.NO );
    doc.add( numField );
    LuceneWork luceneWork = new AddLuceneWork(
        shirt.getId(), String.valueOf( shirt.getId() ), shirt.getClass(), doc
    );
    List<LuceneWork> queue = new ArrayList<LuceneWork>();
View Full Code Here

    for(int i=0;i<numDocs;i++) {
      Document doc = new Document();
      double v = random().nextDouble();
      values[i] = v;
      doc.add(new DoubleDocValuesField("field", v));
      doc.add(new DoubleField("field", v, Field.Store.NO));
      w.addDocument(doc);
      minValue = Math.min(minValue, v);
      maxValue = Math.max(maxValue, v);
    }
    IndexReader r = w.getReader();
View Full Code Here

      fields.add(newStringField("short", "" + ((short) random().nextInt()), Field.Store.NO));
      fields.add(new IntField("int", random().nextInt(), Field.Store.NO));
      fields.add(new LongField("long", random().nextLong(), Field.Store.NO));

      fields.add(new FloatField("float", random().nextFloat(), Field.Store.NO));
      fields.add(new DoubleField("double", random().nextDouble(), Field.Store.NO));
      fields.add(newStringField("bytes", TestUtil.randomRealisticUnicodeString(random()), Field.Store.NO));
      fields.add(newStringField("bytesval", TestUtil.randomRealisticUnicodeString(random()), Field.Store.NO));
      fields.add(new DoubleField("double", random().nextDouble(), Field.Store.NO));

      if (supportsDocValues) {
        fields.add(new NumericDocValuesField("intdocvalues", random().nextInt()));
        fields.add(new FloatDocValuesField("floatdocvalues", random().nextFloat()));
        fields.add(new SortedDocValuesField("sortedbytesdocvalues", new BytesRef(TestUtil.randomRealisticUnicodeString(random()))));
View Full Code Here

    // TODO: we could index in radians instead ... saves all the conversions in getBoundingBoxFilter

    // Add documents with latitude/longitude location:
    Document doc = new Document();
    doc.add(new DoubleField("latitude", 40.759011, Field.Store.NO));
    doc.add(new DoubleField("longitude", -73.9844722, Field.Store.NO));
    writer.addDocument(doc);
   
    doc = new Document();
    doc.add(new DoubleField("latitude", 40.718266, Field.Store.NO));
    doc.add(new DoubleField("longitude", -74.007819, Field.Store.NO));
    writer.addDocument(doc);
   
    doc = new Document();
    doc.add(new DoubleField("latitude", 40.7051157, Field.Store.NO));
    doc.add(new DoubleField("longitude", -74.0088305, Field.Store.NO));
    writer.addDocument(doc);

    // Open near-real-time searcher
    searcher = new IndexSearcher(DirectoryReader.open(writer, true));
    writer.close();
View Full Code Here

  public void testInfiniteValues() throws Exception {
    Directory dir = newDirectory();
    RandomIndexWriter writer = new RandomIndexWriter(random(), dir,
      newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())));
    Document doc = new Document();
    doc.add(new DoubleField("double", Double.NEGATIVE_INFINITY, Field.Store.NO));
    doc.add(new LongField("long", Long.MIN_VALUE, Field.Store.NO));
    writer.addDocument(doc);
   
    doc = new Document();
    doc.add(new DoubleField("double", Double.POSITIVE_INFINITY, Field.Store.NO));
    doc.add(new LongField("long", Long.MAX_VALUE, Field.Store.NO));
    writer.addDocument(doc);
   
    doc = new Document();
    doc.add(new DoubleField("double", 0.0, Field.Store.NO));
    doc.add(new LongField("long", 0L, Field.Store.NO));
    writer.addDocument(doc);
   
    for (double d : TestNumericUtils.DOUBLE_NANs) {
      doc = new Document();
      doc.add(new DoubleField("double", d, Field.Store.NO));
      writer.addDocument(doc);
    }
   
    writer.close();
   
View Full Code Here

  /** @see #createIndexableFields(com.spatial4j.core.shape.Shape) */
  public Field[] createIndexableFields(Point point) {
    FieldType doubleFieldType = new FieldType(DoubleField.TYPE_NOT_STORED);
    doubleFieldType.setNumericPrecisionStep(precisionStep);
    Field[] f = new Field[2];
    f[0] = new DoubleField(fieldNameX, point.getX(), doubleFieldType);
    f[1] = new DoubleField(fieldNameY, point.getY(), doubleFieldType);
    return f;
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.document.DoubleField

Copyright © 2018 www.massapicom. 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.