Package org.apache.lucene.document

Examples of org.apache.lucene.document.DoubleField


        break;
      case LONG:
        field = new LongField(type.name(), 0l, ft);
        break;
      case DOUBLE:
        field = new DoubleField(type.name(), 0.0, ft);
        break;
      default:
        fail();
        field = null;
      }
View Full Code Here


   
    Document doc = new Document();
    doc.add(newStringField("id", "1", Field.Store.YES));
    doc.add(newTextField("body", "some contents and more contents", Field.Store.NO));
    doc.add(new NumericDocValuesField("popularity", 5));
    doc.add(new DoubleField("latitude", 40.759011, Field.Store.NO));
    doc.add(new DoubleField("longitude", -73.9844722, Field.Store.NO));
    iw.addDocument(doc);
   
    doc = new Document();
    doc.add(newStringField("id", "2", Field.Store.YES));
    doc.add(newTextField("body", "another document with different contents", Field.Store.NO));
    doc.add(new NumericDocValuesField("popularity", 20));
    doc.add(new DoubleField("latitude", 40.718266, Field.Store.NO));
    doc.add(new DoubleField("longitude", -74.007819, Field.Store.NO));
    iw.addDocument(doc);
   
    doc = new Document();
    doc.add(newStringField("id", "3", Field.Store.YES));
    doc.add(newTextField("body", "crappy contents", Field.Store.NO));
    doc.add(new NumericDocValuesField("popularity", 2));
    doc.add(new DoubleField("latitude", 40.7051157, Field.Store.NO));
    doc.add(new DoubleField("longitude", -74.0088305, Field.Store.NO));
    iw.addDocument(doc);
   
    reader = iw.getReader();
    searcher = new IndexSearcher(reader);
    iw.close();
View Full Code Here

      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

          sf = new StoredField("nf", f);
          typeAnswer = NumericType.FLOAT;
        } else {
          final double d = random().nextDouble();
          answer = Double.valueOf(d);
          nf = new DoubleField("nf", d, Field.Store.NO);
          sf = new StoredField("nf", d);
          typeAnswer = NumericType.DOUBLE;
        }
      } else {
        // int/long
View Full Code Here

        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();
      for (Field fld : fields) {
View Full Code Here

          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:
          throw new AssertionError("Cannot get here");
        }
        if (reuseFields) {
View Full Code Here

            break;
          case LONG:
            field2 = new LongField(field1.name(), field1.numericValue().intValue(), field1.fieldType());
            break;
          case DOUBLE:
            field2 = new DoubleField(field1.name(), field1.numericValue().intValue(), field1.fieldType());
            break;
          default:
            throw new IllegalStateException("unknown Type: " + numType);
        }
      } else {
View Full Code Here

        doc.add(new TextField("title", docTitle, Store.YES));
        doc.add(new TextField("author", docAuthor, Store.YES));
        doc.add(new TextField("text", docText, Store.YES));
        doc.add(new IntField("year", docYear, Store.YES));
        doc.add(new DoubleField("gross", docGross,  Store.YES));

        return doc;
    }
View Full Code Here

        Document doc = new Document();
        doc.add(new TextField("name", stop.getName(), Field.Store.YES));
        if (stop.getCode() != null) {
            doc.add(new StringField("code", stop.getCode(), Field.Store.YES));
        }
        doc.add(new DoubleField("lat", stop.getLat(), Field.Store.YES));
        doc.add(new DoubleField("lon", stop.getLon(), Field.Store.YES));
        doc.add(new StringField("id", stop.getId().toString(), Field.Store.YES));
        doc.add(new StringField("category", Category.STOP.name(), Field.Store.YES));
        iwriter.addDocument(doc);
    }
View Full Code Here

        }
        if (mainStreet == null || crossStreet == null) return;
        if (mainStreet.equals(crossStreet)) return;
        Document doc = new Document();
        doc.add(new TextField("name", mainStreet + " & " + crossStreet, Field.Store.YES));
        doc.add(new DoubleField("lat", sv.getLat(), Field.Store.YES));
        doc.add(new DoubleField("lon", sv.getLon(), Field.Store.YES));
        doc.add(new StringField("category", Category.CORNER.name(), Field.Store.YES));
        iwriter.addDocument(doc);
    }
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.