Examples of FloatField


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

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

    getLuceneDocument().add( numField );
  }

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

Examples of org.apache.lucene.document.FloatField

  @Override
  public Iterable<? extends Field> getFieldsForColumn(String family, Column column) {
    String name = getName(family, column.getName());
    float value = Float.parseFloat(column.getValue());
    FloatField field = new FloatField(name, value, _typeStored);
    if (isSortEnable()) {
      return addSort(name, Float.floatToRawIntBits(value), field);
    }
    return makeIterable(field);
  }
View Full Code Here

Examples of org.apache.lucene.document.FloatField

  @Override
  public Iterable<? extends Field> getFieldsForSubColumn(String family, Column column, String subName) {
    String name = getName(family, column.getName(), subName);
    float value = Float.parseFloat(column.getValue());
    FloatField field = new FloatField(name, value, _typeNotStored);
    if (isSortEnable()) {
      return addSort(name, Float.floatToRawIntBits(value), field);
    }
    return makeIterable(field);
  }
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

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