本文整理了Java中org.apache.lucene.util.BitSet.length()
方法的一些代码示例,展示了BitSet.length()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BitSet.length()
方法的具体详情如下:
包路径:org.apache.lucene.util.BitSet
类名称:BitSet
方法名:length
暂无
代码示例来源:origin: org.apache.lucene/lucene-core
/** Sole constructor. */
public BitSetIterator(BitSet bits, long cost) {
if (cost < 0) {
throw new IllegalArgumentException("cost must be >= 0, got " + cost);
}
this.bits = bits;
this.length = bits.length();
this.cost = cost;
}
代码示例来源:origin: org.apache.lucene/lucene-core
@Override
public int nextDoc() {
if (docID+1 == dvs.docsWithField.length()) {
docID = NO_MORE_DOCS;
} else {
docID = dvs.docsWithField.nextSetBit(docID+1);
}
return docID;
}
代码示例来源:origin: org.apache.lucene/lucene-core
@Override
public int nextDoc() {
if (docID+1 == dvs.docsWithField.length()) {
docID = NO_MORE_DOCS;
} else {
docID = dvs.docsWithField.nextSetBit(docID+1);
}
return docID;
}
代码示例来源:origin: org.apache.lucene/lucene-core
BitSetConjunctionDISI(DocIdSetIterator lead, Collection<BitSetIterator> bitSetIterators) {
this.lead = lead;
assert bitSetIterators.size() > 0;
this.bitSetIterators = bitSetIterators.toArray(new BitSetIterator[0]);
// Put the least costly iterators first so that we exit as soon as possible
ArrayUtil.timSort(this.bitSetIterators, (a, b) -> Long.compare(a.cost(), b.cost()));
this.bitSets = new BitSet[this.bitSetIterators.length];
int minLen = Integer.MAX_VALUE;
for (int i = 0; i < this.bitSetIterators.length; ++i) {
BitSet bitSet = this.bitSetIterators[i].getBitSet();
this.bitSets[i] = bitSet;
minLen = Math.min(minLen, bitSet.length());
}
this.minLength = minLen;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
private void markChildDocs(BitSet parentDocs, BitSet matchingDocs) {
int currentDeleted = 0;
while (currentDeleted < matchingDocs.length() &&
(currentDeleted = matchingDocs.nextSetBit(currentDeleted)) != DocIdSetIterator.NO_MORE_DOCS) {
int previousParent = parentDocs.prevSetBit(Math.max(0, currentDeleted-1));
for (int i = previousParent + 1; i < currentDeleted; i++) {
matchingDocs.set(i);
}
currentDeleted++;
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
} else {
intersection = ConjunctionDISI.intersectIterators(Arrays.asList(numeric,
new BitSetIterator(recoverySourceToKeep, recoverySourceToKeep.length())));
代码示例来源:origin: org.infinispan/infinispan-embedded-query
/** Sole constructor. */
public BitSetIterator(BitSet bits, long cost) {
this.bits = bits;
this.length = bits.length();
this.cost = cost;
}
代码示例来源:origin: harbby/presto-connectors
/** Sole constructor. */
public BitSetIterator(BitSet bits, long cost) {
this.bits = bits;
this.length = bits.length();
this.cost = cost;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene
/** Sole constructor. */
public BitSetIterator(BitSet bits, long cost) {
if (cost < 0) {
throw new IllegalArgumentException("cost must be >= 0, got " + cost);
}
this.bits = bits;
this.length = bits.length();
this.cost = cost;
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
@Override
public void finish() {
if (previous + 1 < length()) {
clear(previous + 1, length());
}
}
代码示例来源:origin: harbby/presto-connectors
@Override
public void finish() {
if (previous + 1 < length()) {
clear(previous + 1, length());
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene
@Override
public int nextDoc() {
if (docID+1 == dvs.docsWithField.length()) {
docID = NO_MORE_DOCS;
} else {
docID = dvs.docsWithField.nextSetBit(docID+1);
}
return docID;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene
@Override
public int nextDoc() {
if (docID+1 == dvs.docsWithField.length()) {
docID = NO_MORE_DOCS;
} else {
docID = dvs.docsWithField.nextSetBit(docID+1);
}
return docID;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
private void markChildDocs(BitSet parentDocs, BitSet matchingDocs) {
int currentDeleted = 0;
while (currentDeleted < matchingDocs.length() &&
(currentDeleted = matchingDocs.nextSetBit(currentDeleted)) != DocIdSetIterator.NO_MORE_DOCS) {
int previousParent = parentDocs.prevSetBit(Math.max(0, currentDeleted-1));
for (int i = previousParent + 1; i < currentDeleted; i++) {
matchingDocs.set(i);
}
currentDeleted++;
}
}
代码示例来源:origin: apache/servicemix-bundles
private void markChildDocs(BitSet parentDocs, BitSet matchingDocs) {
int currentDeleted = 0;
while (currentDeleted < matchingDocs.length() &&
(currentDeleted = matchingDocs.nextSetBit(currentDeleted)) != DocIdSetIterator.NO_MORE_DOCS) {
int previousParent = parentDocs.prevSetBit(Math.max(0, currentDeleted-1));
for (int i = previousParent + 1; i < currentDeleted; i++) {
matchingDocs.set(i);
}
currentDeleted++;
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene
BitSetConjunctionDISI(DocIdSetIterator lead, Collection<BitSetIterator> bitSetIterators) {
this.lead = lead;
assert bitSetIterators.size() > 0;
this.bitSetIterators = bitSetIterators.toArray(new BitSetIterator[0]);
// Put the least costly iterators first so that we exit as soon as possible
ArrayUtil.timSort(this.bitSetIterators, (a, b) -> Long.compare(a.cost(), b.cost()));
this.bitSets = new BitSet[this.bitSetIterators.length];
int minLen = Integer.MAX_VALUE;
for (int i = 0; i < this.bitSetIterators.length; ++i) {
BitSet bitSet = this.bitSetIterators[i].getBitSet();
this.bitSets[i] = bitSet;
minLen = Math.min(minLen, bitSet.length());
}
this.minLength = minLen;
}
代码示例来源:origin: wikimedia/search-highlighter
private BitSet attemptReuse(BitSet set, int length) {
if (set == null || set.length() < length) {
set = new FixedBitSet(nextPowerOfTwo(length));
} else {
set.clear(0, length);
}
return set;
}
代码示例来源:origin: harbby/presto-connectors
/** Wraps the provided {@link SortedNumericDocValues} in order to only select
* one value per parent among its {@code children} using the configured
* {@code selection} type. */
public static NumericDocValues wrap(SortedNumericDocValues sortedNumerics, Type selection, BitSet parents, BitSet children) {
NumericDocValues values;
switch (selection) {
case MIN:
values = SortedNumericSelector.wrap(sortedNumerics, SortedNumericSelector.Type.MIN, SortField.Type.LONG);
break;
case MAX:
values = SortedNumericSelector.wrap(sortedNumerics, SortedNumericSelector.Type.MAX, SortField.Type.LONG);
break;
default:
throw new AssertionError();
}
return wrap(values, DocValues.docsWithValue(sortedNumerics, parents.length()), selection, parents, children);
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
/** Performs a leap frog between this and the provided iterator in order to find common documents. */
private void leapFrog(DocIdSetIterator iter, LeapFrogCallBack callback) throws IOException {
final int length = length();
int bitSetDoc = -1;
int disiDoc = iter.nextDoc();
while (true) {
// invariant: bitSetDoc <= disiDoc
assert bitSetDoc <= disiDoc;
if (disiDoc >= length) {
callback.finish();
return;
}
if (bitSetDoc < disiDoc) {
bitSetDoc = nextSetBit(disiDoc);
}
if (bitSetDoc == disiDoc) {
callback.onMatch(bitSetDoc);
disiDoc = iter.nextDoc();
} else {
disiDoc = iter.advance(bitSetDoc);
}
}
}
代码示例来源:origin: harbby/presto-connectors
/** Performs a leap frog between this and the provided iterator in order to find common documents. */
private void leapFrog(DocIdSetIterator iter, LeapFrogCallBack callback) throws IOException {
final int length = length();
int bitSetDoc = -1;
int disiDoc = iter.nextDoc();
while (true) {
// invariant: bitSetDoc <= disiDoc
assert bitSetDoc <= disiDoc;
if (disiDoc >= length) {
callback.finish();
return;
}
if (bitSetDoc < disiDoc) {
bitSetDoc = nextSetBit(disiDoc);
}
if (bitSetDoc == disiDoc) {
callback.onMatch(bitSetDoc);
disiDoc = iter.nextDoc();
} else {
disiDoc = iter.advance(bitSetDoc);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!