本文整理匯總了Java中org.apache.lucene.document.IntField.TYPE_NOT_STORED屬性的典型用法代碼示例。如果您正苦於以下問題:Java IntField.TYPE_NOT_STORED屬性的具體用法?Java IntField.TYPE_NOT_STORED怎麽用?Java IntField.TYPE_NOT_STORED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.lucene.document.IntField
的用法示例。
在下文中一共展示了IntField.TYPE_NOT_STORED屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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(IntField.TYPE_STORED);
_typeStored.setNumericPrecisionStep(_precisionStep);
_typeStored.freeze();
_typeNotStored = new FieldType(IntField.TYPE_NOT_STORED);
_typeNotStored.setNumericPrecisionStep(_precisionStep);
_typeNotStored.freeze();
} else {
_typeStored = IntField.TYPE_STORED;
_typeNotStored = IntField.TYPE_NOT_STORED;
}
}
示例2: intField
@Override
public void intField(FieldInfo fieldInfo, int value) {
FieldType ft = new FieldType(IntField.TYPE_NOT_STORED);
ft.setStored(true);
ft.setIndexed(fieldInfo.isIndexed());
doc.add(new IntField(fieldInfo.name, value, ft));
}
示例3: intField
@Override
public void intField(FieldInfo fieldInfo, int value) {
FieldType ft = new FieldType(IntField.TYPE_NOT_STORED);
ft.setStored(true);
ft.setIndexed(fieldInfo.isIndexed());
doc.add(new IntField(fieldInfo.name, value, ft));
}
示例4: beforeClass
@BeforeClass
public static void beforeClass() throws Exception {
noDocs = atLeast(4096);
distance = (1 << 30) / noDocs;
directory = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random(), directory,
newIndexWriterConfig(new MockAnalyzer(random()))
.setMaxBufferedDocs(TestUtil.nextInt(random(), 100, 1000))
.setMergePolicy(newLogMergePolicy()));
final FieldType storedInt = new FieldType(IntField.TYPE_NOT_STORED);
storedInt.setStored(true);
storedInt.freeze();
final FieldType storedInt8 = new FieldType(storedInt);
storedInt8.setNumericPrecisionStep(8);
final FieldType storedInt4 = new FieldType(storedInt);
storedInt4.setNumericPrecisionStep(4);
final FieldType storedInt2 = new FieldType(storedInt);
storedInt2.setNumericPrecisionStep(2);
final FieldType storedIntNone = new FieldType(storedInt);
storedIntNone.setNumericPrecisionStep(Integer.MAX_VALUE);
final FieldType unstoredInt = IntField.TYPE_NOT_STORED;
final FieldType unstoredInt8 = new FieldType(unstoredInt);
unstoredInt8.setNumericPrecisionStep(8);
final FieldType unstoredInt4 = new FieldType(unstoredInt);
unstoredInt4.setNumericPrecisionStep(4);
final FieldType unstoredInt2 = new FieldType(unstoredInt);
unstoredInt2.setNumericPrecisionStep(2);
IntField
field8 = new IntField("field8", 0, storedInt8),
field4 = new IntField("field4", 0, storedInt4),
field2 = new IntField("field2", 0, storedInt2),
fieldNoTrie = new IntField("field"+Integer.MAX_VALUE, 0, storedIntNone),
ascfield8 = new IntField("ascfield8", 0, unstoredInt8),
ascfield4 = new IntField("ascfield4", 0, unstoredInt4),
ascfield2 = new IntField("ascfield2", 0, unstoredInt2);
Document doc = new Document();
// add fields, that have a distance to test general functionality
doc.add(field8); 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(ascfield4); doc.add(ascfield2);
// Add a series of noDocs docs with increasing int values
for (int l=0; l<noDocs; l++) {
int val=distance*l+startOffset;
field8.setIntValue(val);
field4.setIntValue(val);
field2.setIntValue(val);
fieldNoTrie.setIntValue(val);
val=l-(noDocs/2);
ascfield8.setIntValue(val);
ascfield4.setIntValue(val);
ascfield2.setIntValue(val);
writer.addDocument(doc);
}
reader = writer.getReader();
searcher=newSearcher(reader);
writer.close();
}
示例5: beforeClass
@BeforeClass
public static void beforeClass() throws Exception {
noDocs = atLeast(4096);
distance = (1 << 30) / 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 storedInt = new FieldType(IntField.TYPE_NOT_STORED);
storedInt.setStored(true);
storedInt.freeze();
final FieldType storedInt8 = new FieldType(storedInt);
storedInt8.setNumericPrecisionStep(8);
final FieldType storedInt4 = new FieldType(storedInt);
storedInt4.setNumericPrecisionStep(4);
final FieldType storedInt2 = new FieldType(storedInt);
storedInt2.setNumericPrecisionStep(2);
final FieldType storedIntNone = new FieldType(storedInt);
storedIntNone.setNumericPrecisionStep(Integer.MAX_VALUE);
final FieldType unstoredInt = IntField.TYPE_NOT_STORED;
final FieldType unstoredInt8 = new FieldType(unstoredInt);
unstoredInt8.setNumericPrecisionStep(8);
final FieldType unstoredInt4 = new FieldType(unstoredInt);
unstoredInt4.setNumericPrecisionStep(4);
final FieldType unstoredInt2 = new FieldType(unstoredInt);
unstoredInt2.setNumericPrecisionStep(2);
IntField
field8 = new IntField("field8", 0, storedInt8),
field4 = new IntField("field4", 0, storedInt4),
field2 = new IntField("field2", 0, storedInt2),
fieldNoTrie = new IntField("field"+Integer.MAX_VALUE, 0, storedIntNone),
ascfield8 = new IntField("ascfield8", 0, unstoredInt8),
ascfield4 = new IntField("ascfield4", 0, unstoredInt4),
ascfield2 = new IntField("ascfield2", 0, unstoredInt2);
Document doc = new Document();
// add fields, that have a distance to test general functionality
doc.add(field8); 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(ascfield4); doc.add(ascfield2);
// Add a series of noDocs docs with increasing int values
for (int l=0; l<noDocs; l++) {
int val=distance*l+startOffset;
field8.setIntValue(val);
field4.setIntValue(val);
field2.setIntValue(val);
fieldNoTrie.setIntValue(val);
val=l-(noDocs/2);
ascfield8.setIntValue(val);
ascfield4.setIntValue(val);
ascfield2.setIntValue(val);
writer.addDocument(doc);
}
reader = writer.getReader();
searcher=newSearcher(reader);
writer.close();
}