Examples of FloatField


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

    document.add( field );
  }

  public void addFloatFieldToDocument(String fieldName, float floatValue, Document document) {
    checkNotCompressed( fieldName );
    FloatField field = new FloatField( fieldName, floatValue, storeType != Store.NO ? Field.Store.YES : Field.Store.NO );
    setBoost( field );
    document.add( field );
  }
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

      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

  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

        field = new DoubleField(name, d, fieldType);
      }
            else if ("float".equals(paramType)) {
        float f = Float.valueOf(string);
        fieldType.setNumericType(NumericType.FLOAT);
        field = new FloatField(name, f, fieldType);
      }
            else if ("long".equals(paramType)) {
        long l = Long.valueOf(string);
        fieldType.setNumericType(NumericType.LONG);
        field = new LongField(name, l, fieldType);
View Full Code Here

Examples of org.apache.lucene.document.FloatField

        if (type != null) {
            if (Number.class.isAssignableFrom(type)) {
                if (Double.class.isAssignableFrom(type)) {
                    return new DoubleField(name, getValue(Double.class, provider, value), Store.YES);
                } else if (Float.class.isAssignableFrom(type)) {
                    return new FloatField(name, getValue(Float.class, provider, value), Store.YES);
                } else if (Long.class.isAssignableFrom(type)) {
                    return new LongField(name, getValue(Long.class, provider, value), Store.YES);
                } else if (Integer.class.isAssignableFrom(type) || Byte.class.isAssignableFrom(type)) {
                    return new IntField(name, getValue(Integer.class, provider, value), Store.YES);
                }
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

    //numField.setOmitNorms( true );
    //numField.setOmitTermFreqAndPositions( true );
    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
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.