本文整理汇总了Java中org.apache.lucene.search.Filter.getDocIdSet方法的典型用法代码示例。如果您正苦于以下问题:Java Filter.getDocIdSet方法的具体用法?Java Filter.getDocIdSet怎么用?Java Filter.getDocIdSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.search.Filter
的用法示例。
在下文中一共展示了Filter.getDocIdSet方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDISI
import org.apache.lucene.search.Filter; //导入方法依赖的package包/类
private DocIdSetIterator getDISI(Filter filter, AtomicReaderContext context)
throws IOException {
// we dont pass acceptDocs, we will filter at the end using an additional filter
DocIdSet docIdSet = filter.getDocIdSet(context, null);
if (docIdSet == null) {
return DocIdSetIterator.empty();
} else {
DocIdSetIterator iter = docIdSet.iterator();
if (iter == null) {
return DocIdSetIterator.empty();
} else {
return iter;
}
}
}
示例2: tstFilterCard
import org.apache.lucene.search.Filter; //导入方法依赖的package包/类
private void tstFilterCard(String mes, int expected, Filter filt)
throws Exception {
final DocIdSet docIdSet = filt.getDocIdSet(reader.getContext(), reader.getLiveDocs());
int actual = 0;
if (docIdSet != null) {
DocIdSetIterator disi = docIdSet.iterator();
while (disi.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) {
actual++;
}
}
assertEquals(mes, expected, actual);
}
示例3: getDISI
import org.apache.lucene.search.Filter; //导入方法依赖的package包/类
private static DocIdSetIterator getDISI(Filter filter, AtomicReaderContext context)
throws IOException {
// we dont pass acceptDocs, we will filter at the end using an additional filter
final DocIdSet set = filter.getDocIdSet(context, null);
return set == null ? null : set.iterator();
}
示例4: getFilter
import org.apache.lucene.search.Filter; //导入方法依赖的package包/类
@Override
public Filter getFilter(final Filter fastMatchFilter, final ValueSource valueSource) {
return new Filter() {
@Override
public String toString() {
return "Filter(" + LongRange.this.toString() + ")";
}
@Override
public DocIdSet getDocIdSet(AtomicReaderContext context, final Bits acceptDocs) throws IOException {
// TODO: this is just like ValueSourceScorer,
// ValueSourceFilter (spatial),
// ValueSourceRangeFilter (solr); also,
// https://issues.apache.org/jira/browse/LUCENE-4251
final FunctionValues values = valueSource.getValues(Collections.emptyMap(), context);
final int maxDoc = context.reader().maxDoc();
final Bits fastMatchBits;
if (fastMatchFilter != null) {
DocIdSet dis = fastMatchFilter.getDocIdSet(context, null);
if (dis == null) {
// No documents match
return null;
}
fastMatchBits = dis.bits();
if (fastMatchBits == null) {
throw new IllegalArgumentException("fastMatchFilter does not implement DocIdSet.bits");
}
} else {
fastMatchBits = null;
}
return new DocIdSet() {
@Override
public Bits bits() {
return new Bits() {
@Override
public boolean get(int docID) {
if (acceptDocs != null && acceptDocs.get(docID) == false) {
return false;
}
if (fastMatchBits != null && fastMatchBits.get(docID) == false) {
return false;
}
return accept(values.longVal(docID));
}
@Override
public int length() {
return maxDoc;
}
};
}
@Override
public DocIdSetIterator iterator() {
throw new UnsupportedOperationException("this filter can only be accessed via bits()");
}
};
}
};
}
示例5: getFilter
import org.apache.lucene.search.Filter; //导入方法依赖的package包/类
@Override
public Filter getFilter(final Filter fastMatchFilter, final ValueSource valueSource) {
return new Filter() {
@Override
public String toString() {
return "Filter(" + DoubleRange.this.toString() + ")";
}
@Override
public DocIdSet getDocIdSet(AtomicReaderContext context, final Bits acceptDocs) throws IOException {
// TODO: this is just like ValueSourceScorer,
// ValueSourceFilter (spatial),
// ValueSourceRangeFilter (solr); also,
// https://issues.apache.org/jira/browse/LUCENE-4251
final FunctionValues values = valueSource.getValues(Collections.emptyMap(), context);
final int maxDoc = context.reader().maxDoc();
final Bits fastMatchBits;
if (fastMatchFilter != null) {
DocIdSet dis = fastMatchFilter.getDocIdSet(context, null);
if (dis == null) {
// No documents match
return null;
}
fastMatchBits = dis.bits();
if (fastMatchBits == null) {
throw new IllegalArgumentException("fastMatchFilter does not implement DocIdSet.bits");
}
} else {
fastMatchBits = null;
}
return new DocIdSet() {
@Override
public Bits bits() {
return new Bits() {
@Override
public boolean get(int docID) {
if (acceptDocs != null && acceptDocs.get(docID) == false) {
return false;
}
if (fastMatchBits != null && fastMatchBits.get(docID) == false) {
return false;
}
return accept(values.doubleVal(docID));
}
@Override
public int length() {
return maxDoc;
}
};
}
@Override
public DocIdSetIterator iterator() {
throw new UnsupportedOperationException("this filter can only be accessed via bits()");
}
};
}
};
}