Examples of FloatField


Examples of org.apache.lucene.document.FloatField

    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 );
    numField = new LongField( "long", 23l, Store.NO );
    doc.add( numField );

    Map<String, String> analyzers = new HashMap<String, String>();
View Full Code Here

Examples of org.apache.lucene.document.FloatField

  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 FloatField("float", Float.NEGATIVE_INFINITY, Field.Store.NO));
    doc.add(new IntField("int", Integer.MIN_VALUE, Field.Store.NO));
    writer.addDocument(doc);
   
    doc = new Document();
    doc.add(new FloatField("float", Float.POSITIVE_INFINITY, Field.Store.NO));
    doc.add(new IntField("int", Integer.MAX_VALUE, Field.Store.NO));
    writer.addDocument(doc);
   
    doc = new Document();
    doc.add(new FloatField("float", 0.0f, Field.Store.NO));
    doc.add(new IntField("int", 0, Field.Store.NO));
    writer.addDocument(doc);
   
    for (float f : TestNumericUtils.FLOAT_NANs) {
      doc = new Document();
      doc.add(new FloatField("float", f, Field.Store.NO));
      writer.addDocument(doc);
    }
   
    writer.close();
   
View Full Code Here

Examples of org.apache.lucene.document.FloatField

    for(int i=0;i<numDocs;i++) {
      Document doc = new Document();
      float v = random().nextFloat();
      values[i] = v;
      doc.add(new FloatDocValuesField("field", v));
      doc.add(new FloatField("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

Examples of org.apache.lucene.document.FloatField

      fields.add(newStringField("byte", "" + ((byte) random().nextInt()), Field.Store.NO));
      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));
View Full Code Here

Examples of org.apache.lucene.document.FloatField

      for(int docIDX=0;docIDX<numDocs;docIDX++) {
        final Document doc = new Document();
        doc.add(newStringField("string", TestUtil.randomRealisticUnicodeString(random()), Field.Store.NO));
        doc.add(newTextField("text", content[random().nextInt(content.length)], Field.Store.NO));
        doc.add(new FloatField("float", random().nextFloat(), Field.Store.NO));
        final int intValue;
        if (random().nextInt(100) == 17) {
          intValue = Integer.MIN_VALUE;
        } else if (random().nextInt(100) == 17) {
          intValue = Integer.MAX_VALUE;
View Full Code Here

Examples of org.apache.lucene.document.FloatField

      switch(type) {
      case INT:
        field = new IntField(type.name(), 0, ft);
        break;
      case FLOAT:
        field = new FloatField(type.name(), 0.0f, ft);
        break;
      case LONG:
        field = new LongField(type.name(), 0l, ft);
        break;
      case DOUBLE:
View Full Code Here

Examples of org.apache.lucene.document.FloatField

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

      document.add(new FloatField("float", random().nextFloat(), Field.Store.NO));
      document.add(new DoubleField("double", random().nextDouble(), Field.Store.NO));

      document.add(new NumericDocValuesField("intdocvalues", random().nextInt()));
      document.add(new FloatDocValuesField("floatdocvalues", random().nextFloat()));
      iw.addDocument(document);
View Full Code Here

Examples of org.apache.lucene.document.FloatField

      if (random().nextBoolean()) {
        // float/double
        if (random().nextBoolean()) {
          final float f = random().nextFloat();
          answer = Float.valueOf(f);
          nf = new FloatField("nf", f, Field.Store.NO);
          sf = new StoredField("nf", f);
          typeAnswer = NumericType.FLOAT;
        } else {
          final double d = random().nextDouble();
          answer = Double.valueOf(d);
View Full Code Here

Examples of org.apache.lucene.document.FloatField

    List<Field> fields = Arrays.asList(
        new Field("bytes", bytes, ft),
        new Field("string", string, ft),
        new LongField("long", l, Store.YES),
        new IntField("int", i, Store.YES),
        new FloatField("float", f, Store.YES),
        new DoubleField("double", d, Store.YES)
    );

    for (int k = 0; k < 100; ++k) {
      Document doc = new Document();
View Full Code Here

Examples of org.apache.lucene.document.FloatField

          break;
        case LONG:
          f = new LongField(name, 0L, Field.Store.NO);
          break;
        case FLOAT:
          f = new FloatField(name, 0.0F, Field.Store.NO);
          break;
        case DOUBLE:
          f = new DoubleField(name, 0.0, Field.Store.NO);
          break;
        default:
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.