本文整理汇总了Java中org.apache.lucene.util.FixedBitSet.length方法的典型用法代码示例。如果您正苦于以下问题:Java FixedBitSet.length方法的具体用法?Java FixedBitSet.length怎么用?Java FixedBitSet.length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.util.FixedBitSet
的用法示例。
在下文中一共展示了FixedBitSet.length方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: next
import org.apache.lucene.util.FixedBitSet; //导入方法依赖的package包/类
@Override
public void next() {
LimitedBitSetHitCollector collector = (LimitedBitSetHitCollector) this.getCollector();
int atomicDocId = this.currentAtomicDocId;
if (currentAtomicReaderId < collector.getFixedSets().size()) {
do {
FixedBitSet bitSet = collector.getFixedSets().get(currentAtomicReaderId);
if (atomicDocId == DocIdSetIterator.NO_MORE_DOCS) { // we start a new reader, reset the doc id
atomicDocId = -1;
}
atomicDocId = atomicDocId + 1 < bitSet.length() ? bitSet.nextSetBit(atomicDocId + 1) : DocIdSetIterator.NO_MORE_DOCS;
} while (atomicDocId == DocIdSetIterator.NO_MORE_DOCS && ++currentAtomicReaderId < collector.getFixedSets().size());
}
this.currentAtomicDocId = atomicDocId;
this.count++;
}
示例2: andNot
import org.apache.lucene.util.FixedBitSet; //导入方法依赖的package包/类
@Override
public DocSet andNot(DocSet other) {
FixedBitSet newbits = bits.clone();
if (other instanceof BitDocSet) {
newbits.andNot(((BitDocSet) other).bits);
} else {
DocIterator iter = other.iterator();
while (iter.hasNext()) {
int doc = iter.nextDoc();
if (doc < newbits.length()) {
newbits.clear(doc);
}
}
}
return new BitDocSet(newbits);
}
示例3: randomInnerDocs
import org.apache.lucene.util.FixedBitSet; //导入方法依赖的package包/类
private static FixedBitSet randomInnerDocs(FixedBitSet rootDocs) {
FixedBitSet innerDocs = new FixedBitSet(rootDocs.length());
for (int i = 0; i < innerDocs.length(); ++i) {
if (!rootDocs.get(i) && randomBoolean()) {
innerDocs.set(i);
}
}
return innerDocs;
}
示例4: advanceRpts
import org.apache.lucene.util.FixedBitSet; //导入方法依赖的package包/类
/** pp was just advanced. If that caused a repeater collision, resolve by advancing the lesser
* of the two colliding pps. Note that there can only be one collision, as by the initialization
* there were no collisions before pp was advanced. */
private boolean advanceRpts(PhrasePositions pp) throws IOException {
if (pp.rptGroup < 0) {
return true; // not a repeater
}
PhrasePositions[] rg = rptGroups[pp.rptGroup];
FixedBitSet bits = new FixedBitSet(rg.length); // for re-queuing after collisions are resolved
int k0 = pp.rptInd;
int k;
while((k=collide(pp)) >= 0) {
pp = lesser(pp, rg[k]); // always advance the lesser of the (only) two colliding pps
if (!advancePP(pp)) {
return false; // exhausted
}
if (k != k0) { // careful: mark only those currently in the queue
bits = FixedBitSet.ensureCapacity(bits, k);
bits.set(k); // mark that pp2 need to be re-queued
}
}
// collisions resolved, now re-queue
// empty (partially) the queue until seeing all pps advanced for resolving collisions
int n = 0;
// TODO would be good if we can avoid calling cardinality() in each iteration!
int numBits = bits.length(); // larges bit we set
while (bits.cardinality() > 0) {
PhrasePositions pp2 = pq.pop();
rptStack[n++] = pp2;
if (pp2.rptGroup >= 0
&& pp2.rptInd < numBits // this bit may not have been set
&& bits.get(pp2.rptInd)) {
bits.clear(pp2.rptInd);
}
}
// add back to queue
for (int i=n-1; i>=0; i--) {
pq.add(rptStack[i]);
}
return true;
}
示例5: BinaryVector
import org.apache.lucene.util.FixedBitSet; //导入方法依赖的package包/类
protected BinaryVector(FixedBitSet inSet) {
this.dimension = (int) inSet.length();
this.bitSet = inSet;
}