本文整理匯總了Java中org.apache.lucene.util.Bits.MatchAllBits方法的典型用法代碼示例。如果您正苦於以下問題:Java Bits.MatchAllBits方法的具體用法?Java Bits.MatchAllBits怎麽用?Java Bits.MatchAllBits使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.lucene.util.Bits
的用法示例。
在下文中一共展示了Bits.MatchAllBits方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getMissingBits
import org.apache.lucene.util.Bits; //導入方法依賴的package包/類
private Bits getMissingBits(final long offset) throws IOException {
if (offset == -1) {
return new Bits.MatchAllBits(maxDoc);
} else {
final IndexInput in = data.clone();
return new Bits() {
@Override
public boolean get(int index) {
try {
in.seek(offset + (index >> 3));
return (in.readByte() & (1 << (index & 7))) != 0;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@Override
public int length() {
return maxDoc;
}
};
}
}
示例2: getMissingBits
import org.apache.lucene.util.Bits; //導入方法依賴的package包/類
private Bits getMissingBits(final long offset) throws IOException {
if (offset == -1) {
return new Bits.MatchAllBits(maxDoc);
} else {
int length = (int) ((maxDoc + 7L) >>> 3);
final RandomAccessInput in = data.randomAccessSlice(offset, length);
return new Bits() {
@Override
public boolean get(int index) {
try {
return (in.readByte(index >> 3) & (1 << (index & 7))) != 0;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@Override
public int length() {
return maxDoc;
}
};
}
}
示例3: getDocsWithField
import org.apache.lucene.util.Bits; //導入方法依賴的package包/類
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
if (field.getDocValuesType() == FieldInfo.DocValuesType.SORTED_SET) {
return DocValues.docsWithValue(getSortedSet(field), maxDoc);
} else {
return new Bits.MatchAllBits(maxDoc);
}
}
示例4: setNextReader
import org.apache.lucene.util.Bits; //導入方法依賴的package包/類
@Override
public FieldComparator<T> setNextReader(AtomicReaderContext context) throws IOException {
if (missingValue != null) {
docsWithField = FieldCache.DEFAULT.getDocsWithField(context.reader(), field);
// optimization to remove unneeded checks on the bit interface:
if (docsWithField instanceof Bits.MatchAllBits) {
docsWithField = null;
}
} else {
docsWithField = null;
}
return this;
}
示例5: ramBytesUsed
import org.apache.lucene.util.Bits; //導入方法依賴的package包/類
@Override
public long ramBytesUsed() {
long base = RamUsageEstimator.NUM_BYTES_OBJECT_REF;
if (bits instanceof Bits.MatchAllBits || bits instanceof Bits.MatchNoBits) {
return base;
} else {
return base + (bits.length() >>> 3);
}
}
示例6: getDocsWithField
import org.apache.lucene.util.Bits; //導入方法依賴的package包/類
/** Returns a Bits for a reader's docsWithField (potentially merging on-the-fly)
* <p>
* This is a slow way to access this bitset. Instead, access them per-segment
* with {@link AtomicReader#getDocsWithField(String)}
* </p>
* */
public static Bits getDocsWithField(final IndexReader r, final String field) throws IOException {
final List<AtomicReaderContext> leaves = r.leaves();
final int size = leaves.size();
if (size == 0) {
return null;
} else if (size == 1) {
return leaves.get(0).reader().getDocsWithField(field);
}
boolean anyReal = false;
boolean anyMissing = false;
final Bits[] values = new Bits[size];
final int[] starts = new int[size+1];
for (int i = 0; i < size; i++) {
AtomicReaderContext context = leaves.get(i);
Bits v = context.reader().getDocsWithField(field);
if (v == null) {
v = new Bits.MatchNoBits(context.reader().maxDoc());
anyMissing = true;
} else {
anyReal = true;
if (v instanceof Bits.MatchAllBits == false) {
anyMissing = true;
}
}
values[i] = v;
starts[i] = context.docBase;
}
starts[size] = r.maxDoc();
if (!anyReal) {
return null;
} else if (!anyMissing) {
return new Bits.MatchAllBits(r.maxDoc());
} else {
return new MultiBits(values, starts, false);
}
}
示例7: getDocsWithField
import org.apache.lucene.util.Bits; //導入方法依賴的package包/類
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
if (VersionFieldMapper.NAME.equals(field.name)) {
return new Bits.MatchAllBits(reader.maxDoc());
} else {
return in.getDocsWithField(field);
}
}
示例8: getDocsWithField
import org.apache.lucene.util.Bits; //導入方法依賴的package包/類
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
return new Bits.MatchAllBits(state.segmentInfo.getDocCount());
}