Package org.apache.lucene.document

Examples of org.apache.lucene.document.LongField


    doc.add(new Field("utf8", "Lu\uD834\uDD1Ece\uD834\uDD60ne \u0000 \u2620 ab\ud917\udc17cd", customType2));
    doc.add(new Field("content2", "here is more content with aaa aaa aaa", customType2));
    doc.add(new Field("fie\u2C77ld", "field with non-ascii name", customType2));
    // add numeric fields, to test if flex preserves encoding
    doc.add(new IntField("trieInt", id, Field.Store.NO));
    doc.add(new LongField("trieLong", (long) id, Field.Store.NO));
    // add docvalues fields
    doc.add(new NumericDocValuesField("dvByte", (byte) id));
    byte bytes[] = new byte[] {
      (byte)(id >>> 24), (byte)(id >>> 16),(byte)(id >>> 8),(byte)id
    };
View Full Code Here


          // NumericRangeFilter).  This indexes to milli-second resolution, which
          // is often too fine.  You could instead create a number based on
          // year/month/day/hour/minutes/seconds, down the resolution you require.
          // For example the long value 2011021714 would mean
          // February 17, 2011, 2-3 PM.
          doc.add(new LongField("modified", file.lastModified(), Field.Store.NO));

          // Add the contents of the file to a field named "contents".  Specify a Reader,
          // so that the text of the file is tokenized and indexed, but not stored.
          // Note that FileReader expects the file to be in UTF-8 encoding.
          // If that's not the case searching for special characters will fail.
View Full Code Here

        break;
      case FLOAT:
        field = new FloatField(type.name(), 0.0f, ft);
        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;
      }
      numericFieldMap.put(type.name(), field);
      doc.add(field);
    }
   
    numericConfigMap.put(DATE_FIELD_NAME, new NumericConfig(PRECISION_STEP,
        DATE_FORMAT, NumericType.LONG));
    FieldType ft = new FieldType(LongField.TYPE_NOT_STORED);
    ft.setStored(true);
    ft.setNumericPrecisionStep(PRECISION_STEP);
    LongField dateField = new LongField(DATE_FIELD_NAME, 0l, ft);
    numericFieldMap.put(DATE_FIELD_NAME, dateField);
    doc.add(dateField);
   
    for (NumberType numberType : NumberType.values()) {
      setFieldValues(numberType, numericFieldMap);
View Full Code Here

      return f;

    } else if("LONG".equalsIgnoreCase(collectionField.getType())) {
      fieldType.setNumericType(NumericType.LONG);
     
      Field f = new LongField(collectionField.getName(),
          Long.parseLong(value),
          fieldType);
     
      logger.debug("Field : {}", f);
     
View Full Code Here

      document.add(newTextField("english", English.intToEnglish(i), Field.Store.NO));
      document.add(newTextField("oddeven", (i % 2 == 0) ? "even" : "odd", Field.Store.NO));
      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()));
View Full Code Here

          sf = new StoredField("nf", i);
          typeAnswer = NumericType.INT;
        } else {
          final long l = random().nextLong();
          answer = Long.valueOf(l);
          nf = new LongField("nf", l, Field.Store.NO);
          sf = new StoredField("nf", l);
          typeAnswer = NumericType.LONG;
        }
      }
      doc.add(nf);
View Full Code Here

    final double d = random().nextDouble();

    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)
    );
View Full Code Here

        fields.put(TITLE_FIELD, new Field(TITLE_FIELD, "", ft));
        fields.put(DATE_FIELD, new Field(DATE_FIELD, "", ft));
        fields.put(ID_FIELD, new StringField(ID_FIELD, "", Field.Store.YES));
        fields.put(NAME_FIELD, new Field(NAME_FIELD, "", ft));

        numericFields.put(DATE_MSEC_FIELD, new LongField(DATE_MSEC_FIELD, 0L, Field.Store.NO));
        numericFields.put(TIME_SEC_FIELD, new IntField(TIME_SEC_FIELD, 0, Field.Store.NO));
       
        doc = new Document();
      } else {
        numericFields = null;
View Full Code Here

        switch(type) {
        case INT:
          f = new IntField(name, 0, Field.Store.NO);
          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:
View Full Code Here

            break;
          case FLOAT:
            field2 = new FloatField(field1.name(), field1.numericValue().intValue(), field1.fieldType());
            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:
View Full Code Here

TOP

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

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.