org.apache.lucene.search
public class: QueryWrapperFilter [javadoc |
source]
java.lang.Object
org.apache.lucene.search.Filter
org.apache.lucene.search.QueryWrapperFilter
All Implemented Interfaces:
Serializable
Constrains search results to only match those which also match a provided
query.
This could be used, for example, with a RangeQuery on a suitably
formatted date field to implement date filtering. One could re-use a single
QueryFilter that matches, e.g., only documents modified within the last
week. The QueryFilter and RangeQuery would only need to be reconstructed
once per day.
| Method from org.apache.lucene.search.QueryWrapperFilter Detail: |
public BitSet bits(IndexReader reader) throws IOException {
final BitSet bits = new BitSet(reader.maxDoc());
new IndexSearcher(reader).search(query, new HitCollector() {
public final void collect(int doc, float score) {
bits.set(doc); // set bit for hit
}
});
return bits;
} Deprecated! Use - #getDocIdSet(IndexReader) instead.
|
public boolean equals(Object o) {
if (!(o instanceof QueryWrapperFilter))
return false;
return this.query.equals(((QueryWrapperFilter)o).query);
}
|
public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
final OpenBitSet bits = new OpenBitSet(reader.maxDoc());
new IndexSearcher(reader).search(query, new HitCollector() {
public final void collect(int doc, float score) {
bits.set(doc); // set bit for hit
}
});
return bits;
}
|
public int hashCode() {
return query.hashCode() ^ 0x923F64B9;
}
|
public String toString() {
return "QueryWrapperFilter(" + query + ")";
}
|