本文整理汇总了Java中org.apache.lucene.util.FixedBitSet.flip方法的典型用法代码示例。如果您正苦于以下问题:Java FixedBitSet.flip方法的具体用法?Java FixedBitSet.flip怎么用?Java FixedBitSet.flip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.util.FixedBitSet
的用法示例。
在下文中一共展示了FixedBitSet.flip方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialResult
import org.apache.lucene.util.FixedBitSet; //导入方法依赖的package包/类
private FixedBitSet initialResult(AtomicReaderContext context, int logic, int[] index)
throws IOException {
AtomicReader reader = context.reader();
FixedBitSet result = new FixedBitSet(reader.maxDoc());
if (logic == AND) {
result.or(getDISI(chain[index[0]], context));
++index[0];
} else if (logic == ANDNOT) {
result.or(getDISI(chain[index[0]], context));
result.flip(0, reader.maxDoc()); // NOTE: may set bits for deleted docs.
++index[0];
}
return result;
}
示例2: getDocIdSet
import org.apache.lucene.util.FixedBitSet; //导入方法依赖的package包/类
/**
* Return the {@link DocIdSet} representing the documents of the
* virtual collection to be used in searches.
* This will respect deleted documents.
*
* @param atomic
* The {@link LeafReaderContext} to search in.
* @param accepted
* {@link Bits} vector of accepted documents.
* @throws IOException
*/
public DocIdSet getDocIdSet (LeafReaderContext atomic, Bits acceptDocs)
throws IOException {
int maxDoc = atomic.reader().maxDoc();
FixedBitSet bitset = new FixedBitSet(maxDoc);
Filter filter;
if (this.cbi == null || (filter = this.cbi.toFilter()) == null) {
if (acceptDocs == null)
return null;
bitset.set(0, maxDoc);
}
else {
// Init vector
DocIdSet docids = filter.getDocIdSet(atomic, null);
DocIdSetIterator filterIter = (docids == null) ? null
: docids.iterator();
if (filterIter == null) {
if (!this.cbi.isNegative())
return null;
bitset.set(0, maxDoc);
}
else {
// Or bit set
bitset.or(filterIter);
// Revert for negation
if (this.cbi.isNegative())
bitset.flip(0, maxDoc);
};
};
if (DEBUG) {
log.debug("Bit set is {}", _bits(bitset));
log.debug("Livedocs is {}", _bits(acceptDocs));
};
// Remove deleted docs
return (DocIdSet) BitsFilteredDocIdSet
.wrap((DocIdSet) new BitDocIdSet(bitset), acceptDocs);
}