本文整理汇总了Java中org.apache.lucene.index.AtomicReader.getBinaryDocValues方法的典型用法代码示例。如果您正苦于以下问题:Java AtomicReader.getBinaryDocValues方法的具体用法?Java AtomicReader.getBinaryDocValues怎么用?Java AtomicReader.getBinaryDocValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.index.AtomicReader
的用法示例。
在下文中一共展示了AtomicReader.getBinaryDocValues方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTerms
import org.apache.lucene.index.AtomicReader; //导入方法依赖的package包/类
public BinaryDocValues getTerms(AtomicReader reader, String field, boolean setDocsWithField, float acceptableOverheadRatio) throws IOException {
BinaryDocValues valuesIn = reader.getBinaryDocValues(field);
if (valuesIn == null) {
valuesIn = reader.getSortedDocValues(field);
}
if (valuesIn != null) {
// Not cached here by FieldCacheImpl (cached instead
// per-thread by SegmentReader):
return valuesIn;
}
final FieldInfo info = reader.getFieldInfos().fieldInfo(field);
if (info == null) {
return DocValues.emptyBinary();
} else if (info.hasDocValues()) {
throw new IllegalStateException("Type mismatch: " + field + " was indexed as " + info.getDocValuesType());
} else if (!info.isIndexed()) {
return DocValues.emptyBinary();
}
BinaryDocValuesImpl impl = (BinaryDocValuesImpl) caches.get(BinaryDocValues.class).get(reader, new CacheKey(field, acceptableOverheadRatio), setDocsWithField);
return impl.iterator();
}
示例2: createValue
import org.apache.lucene.index.AtomicReader; //导入方法依赖的package包/类
@Override
protected Accountable createValue(final AtomicReader reader, CacheKey key, boolean setDocsWithField)
throws IOException {
int maxDoc = reader.maxDoc();
final int[][] matrix = new int[maxDoc][];
BinaryDocValues valuesIn = reader.getBinaryDocValues(key.field);
if (valuesIn == null) {
for (int i = 0; i < maxDoc; ++i) {
matrix[i] = new int[0];
}
return new IntList(matrix);
}
for (int i = 0; i < maxDoc; ++i) {
String str = valuesIn.get(i).utf8ToString();
if (StringUtils.isEmpty(str)) {
matrix[i] = new int[0];
continue;
}
JSONArray array = JSON.parseArray(str);
matrix[i] = new int[array.size()];
for (int j = 0; j < array.size(); ++j) {
matrix[i][j] = array.getInteger(j);
}
}
return new IntList(matrix);
}
示例3: assertOrdinalsExist
import org.apache.lucene.index.AtomicReader; //导入方法依赖的package包/类
private void assertOrdinalsExist(String field, IndexReader ir) throws IOException {
for (AtomicReaderContext context : ir.leaves()) {
AtomicReader r = context.reader();
if (r.getBinaryDocValues(field) != null) {
return; // not all segments must have this DocValues
}
}
fail("no ordinals found for " + field);
}