本文整理汇总了Java中org.apache.lucene.document.LongField.TYPE_NOT_STORED属性的典型用法代码示例。如果您正苦于以下问题:Java LongField.TYPE_NOT_STORED属性的具体用法?Java LongField.TYPE_NOT_STORED怎么用?Java LongField.TYPE_NOT_STORED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.lucene.document.LongField
的用法示例。
在下文中一共展示了LongField.TYPE_NOT_STORED属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
@Override
public void configure(String fieldNameForThisInstance, Map<String, String> properties, Configuration configuration) {
final String dateFormat = properties.get(DATE_FORMAT);
if (dateFormat == null) {
throw new RuntimeException("The property [" + DATE_FORMAT + "] can not be null.");
}
final String timeUnitStr = properties.get(TIME_UNIT);
if (timeUnitStr != null) {
_timeUnit = TimeUnit.valueOf(timeUnitStr.trim().toUpperCase());
}
_simpleDateFormat = new ThreadValue<SimpleDateFormat>() {
@Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat(dateFormat);
}
};
String precisionStepStr = properties.get(NUMERIC_PRECISION_STEP);
if (precisionStepStr != null) {
_precisionStep = Integer.parseInt(precisionStepStr);
_typeNotStored = new FieldType(LongField.TYPE_NOT_STORED);
_typeNotStored.setNumericPrecisionStep(_precisionStep);
_typeNotStored.freeze();
} else {
_typeNotStored = LongField.TYPE_NOT_STORED;
}
}
示例2: configure
@Override
public void configure(String fieldNameForThisInstance, Map<String, String> properties, Configuration configuration) {
String precisionStepStr = properties.get(NUMERIC_PRECISION_STEP);
if (precisionStepStr != null) {
_precisionStep = Integer.parseInt(precisionStepStr);
_typeStored = new FieldType(LongField.TYPE_STORED);
_typeStored.setNumericPrecisionStep(_precisionStep);
_typeStored.freeze();
_typeNotStored = new FieldType(LongField.TYPE_NOT_STORED);
_typeNotStored.setNumericPrecisionStep(_precisionStep);
_typeNotStored.freeze();
} else {
_typeStored = LongField.TYPE_STORED;
_typeNotStored = LongField.TYPE_NOT_STORED;
}
}
示例3: longField
@Override
public void longField(FieldInfo fieldInfo, long value) {
FieldType ft = new FieldType(LongField.TYPE_NOT_STORED);
ft.setStored(true);
ft.setIndexed(fieldInfo.isIndexed());
doc.add(new LongField(fieldInfo.name, value, ft));
}
示例4: longField
@Override
public void longField(FieldInfo fieldInfo, long value) {
FieldType ft = new FieldType(LongField.TYPE_NOT_STORED);
ft.setStored(true);
ft.setIndexed(fieldInfo.isIndexed());
doc.add(new LongField(fieldInfo.name, value, ft));
}
示例5: beforeClass
@BeforeClass
public static void beforeClass() throws Exception {
noDocs = atLeast(4096);
distance = (1L << 60) / noDocs;
directory = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random(), directory,
newIndexWriterConfig(new MockAnalyzer(random()))
.setMaxBufferedDocs(TestUtil.nextInt(random(), 100, 1000))
.setMergePolicy(newLogMergePolicy()));
final FieldType storedLong = new FieldType(LongField.TYPE_NOT_STORED);
storedLong.setStored(true);
storedLong.freeze();
final FieldType storedLong8 = new FieldType(storedLong);
storedLong8.setNumericPrecisionStep(8);
final FieldType storedLong4 = new FieldType(storedLong);
storedLong4.setNumericPrecisionStep(4);
final FieldType storedLong6 = new FieldType(storedLong);
storedLong6.setNumericPrecisionStep(6);
final FieldType storedLong2 = new FieldType(storedLong);
storedLong2.setNumericPrecisionStep(2);
final FieldType storedLongNone = new FieldType(storedLong);
storedLongNone.setNumericPrecisionStep(Integer.MAX_VALUE);
final FieldType unstoredLong = LongField.TYPE_NOT_STORED;
final FieldType unstoredLong8 = new FieldType(unstoredLong);
unstoredLong8.setNumericPrecisionStep(8);
final FieldType unstoredLong6 = new FieldType(unstoredLong);
unstoredLong6.setNumericPrecisionStep(6);
final FieldType unstoredLong4 = new FieldType(unstoredLong);
unstoredLong4.setNumericPrecisionStep(4);
final FieldType unstoredLong2 = new FieldType(unstoredLong);
unstoredLong2.setNumericPrecisionStep(2);
LongField
field8 = new LongField("field8", 0L, storedLong8),
field6 = new LongField("field6", 0L, storedLong6),
field4 = new LongField("field4", 0L, storedLong4),
field2 = new LongField("field2", 0L, storedLong2),
fieldNoTrie = new LongField("field"+Integer.MAX_VALUE, 0L, storedLongNone),
ascfield8 = new LongField("ascfield8", 0L, unstoredLong8),
ascfield6 = new LongField("ascfield6", 0L, unstoredLong6),
ascfield4 = new LongField("ascfield4", 0L, unstoredLong4),
ascfield2 = new LongField("ascfield2", 0L, unstoredLong2);
Document doc = new Document();
// add fields, that have a distance to test general functionality
doc.add(field8); doc.add(field6); doc.add(field4); doc.add(field2); doc.add(fieldNoTrie);
// add ascending fields with a distance of 1, beginning at -noDocs/2 to test the correct splitting of range and inclusive/exclusive
doc.add(ascfield8); doc.add(ascfield6); doc.add(ascfield4); doc.add(ascfield2);
// Add a series of noDocs docs with increasing long values, by updating the fields
for (int l=0; l<noDocs; l++) {
long val=distance*l+startOffset;
field8.setLongValue(val);
field6.setLongValue(val);
field4.setLongValue(val);
field2.setLongValue(val);
fieldNoTrie.setLongValue(val);
val=l-(noDocs/2);
ascfield8.setLongValue(val);
ascfield6.setLongValue(val);
ascfield4.setLongValue(val);
ascfield2.setLongValue(val);
writer.addDocument(doc);
}
reader = writer.getReader();
searcher=newSearcher(reader);
writer.close();
}
示例6: beforeClass
@BeforeClass
public static void beforeClass() throws Exception {
noDocs = atLeast(4096);
distance = (1L << 60) / noDocs;
directory = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random(), directory,
newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()))
.setMaxBufferedDocs(_TestUtil.nextInt(random(), 100, 1000))
.setMergePolicy(newLogMergePolicy()));
final FieldType storedLong = new FieldType(LongField.TYPE_NOT_STORED);
storedLong.setStored(true);
storedLong.freeze();
final FieldType storedLong8 = new FieldType(storedLong);
storedLong8.setNumericPrecisionStep(8);
final FieldType storedLong4 = new FieldType(storedLong);
storedLong4.setNumericPrecisionStep(4);
final FieldType storedLong6 = new FieldType(storedLong);
storedLong6.setNumericPrecisionStep(6);
final FieldType storedLong2 = new FieldType(storedLong);
storedLong2.setNumericPrecisionStep(2);
final FieldType storedLongNone = new FieldType(storedLong);
storedLongNone.setNumericPrecisionStep(Integer.MAX_VALUE);
final FieldType unstoredLong = LongField.TYPE_NOT_STORED;
final FieldType unstoredLong8 = new FieldType(unstoredLong);
unstoredLong8.setNumericPrecisionStep(8);
final FieldType unstoredLong6 = new FieldType(unstoredLong);
unstoredLong6.setNumericPrecisionStep(6);
final FieldType unstoredLong4 = new FieldType(unstoredLong);
unstoredLong4.setNumericPrecisionStep(4);
final FieldType unstoredLong2 = new FieldType(unstoredLong);
unstoredLong2.setNumericPrecisionStep(2);
LongField
field8 = new LongField("field8", 0L, storedLong8),
field6 = new LongField("field6", 0L, storedLong6),
field4 = new LongField("field4", 0L, storedLong4),
field2 = new LongField("field2", 0L, storedLong2),
fieldNoTrie = new LongField("field"+Integer.MAX_VALUE, 0L, storedLongNone),
ascfield8 = new LongField("ascfield8", 0L, unstoredLong8),
ascfield6 = new LongField("ascfield6", 0L, unstoredLong6),
ascfield4 = new LongField("ascfield4", 0L, unstoredLong4),
ascfield2 = new LongField("ascfield2", 0L, unstoredLong2);
Document doc = new Document();
// add fields, that have a distance to test general functionality
doc.add(field8); doc.add(field6); doc.add(field4); doc.add(field2); doc.add(fieldNoTrie);
// add ascending fields with a distance of 1, beginning at -noDocs/2 to test the correct splitting of range and inclusive/exclusive
doc.add(ascfield8); doc.add(ascfield6); doc.add(ascfield4); doc.add(ascfield2);
// Add a series of noDocs docs with increasing long values, by updating the fields
for (int l=0; l<noDocs; l++) {
long val=distance*l+startOffset;
field8.setLongValue(val);
field6.setLongValue(val);
field4.setLongValue(val);
field2.setLongValue(val);
fieldNoTrie.setLongValue(val);
val=l-(noDocs/2);
ascfield8.setLongValue(val);
ascfield6.setLongValue(val);
ascfield4.setLongValue(val);
ascfield2.setLongValue(val);
writer.addDocument(doc);
}
reader = writer.getReader();
searcher=newSearcher(reader);
writer.close();
}