public final class XFilteredQuery
extends org.apache.lucene.search.Query
Note: the bits are retrieved from the filter each time this query is used in a search - use a CachingWrapperFilter to avoid regenerating the bits every time.
CachingWrapperFilter
Modifier and Type | Class and Description |
---|---|
static class |
XFilteredQuery.CustomRandomAccessFilterStrategy
Extends
FilteredQuery.RandomAccessFilterStrategy . |
Modifier and Type | Field and Description |
---|---|
static org.apache.lucene.search.FilteredQuery.FilterStrategy |
ALWAYS_RANDOM_ACCESS_FILTER_STRATEGY |
static XFilteredQuery.CustomRandomAccessFilterStrategy |
CUSTOM_FILTER_STRATEGY |
Constructor and Description |
---|
XFilteredQuery(org.apache.lucene.search.Query query,
org.apache.lucene.search.Filter filter)
Constructs a new query which applies a filter to the results of the original query.
|
XFilteredQuery(org.apache.lucene.search.Query query,
org.apache.lucene.search.Filter filter,
org.apache.lucene.search.FilteredQuery.FilterStrategy strategy)
Expert: Constructs a new query which applies a filter to the results of the original query.
|
Modifier and Type | Method and Description |
---|---|
org.apache.lucene.search.Query |
clone() |
org.apache.lucene.search.Weight |
createWeight(org.apache.lucene.search.IndexSearcher searcher)
Returns a Weight that applies the filter to the enclosed query's Weight.
|
boolean |
equals(Object o)
Returns true iff
o is equal to this. |
void |
extractTerms(Set<org.apache.lucene.index.Term> terms) |
float |
getBoost() |
org.apache.lucene.search.Filter |
getFilter()
Returns this FilteredQuery's filter
|
org.apache.lucene.search.Query |
getQuery()
Returns this FilteredQuery's (unfiltered) Query
|
int |
hashCode()
Returns a hash code value for this object.
|
org.apache.lucene.search.Query |
rewrite(org.apache.lucene.index.IndexReader reader)
Rewrites the query.
|
void |
setBoost(float b) |
String |
toString(String s)
Prints a user-readable version of this query.
|
public static final org.apache.lucene.search.FilteredQuery.FilterStrategy ALWAYS_RANDOM_ACCESS_FILTER_STRATEGY
public static final XFilteredQuery.CustomRandomAccessFilterStrategy CUSTOM_FILTER_STRATEGY
public XFilteredQuery(org.apache.lucene.search.Query query, org.apache.lucene.search.Filter filter)
Filter.getDocIdSet(org.apache.lucene.index.AtomicReaderContext, org.apache.lucene.util.Bits)
will be called every time this query is used in a search.query
- Query to be filtered, cannot be null
.filter
- Filter to apply to query results, cannot be null
.public XFilteredQuery(org.apache.lucene.search.Query query, org.apache.lucene.search.Filter filter, org.apache.lucene.search.FilteredQuery.FilterStrategy strategy)
Filter.getDocIdSet(org.apache.lucene.index.AtomicReaderContext, org.apache.lucene.util.Bits)
will be called every time this query is used in a search.query
- Query to be filtered, cannot be null
.filter
- Filter to apply to query results, cannot be null
.strategy
- a filter strategy used to create a filtered scorer.FilteredQuery.FilterStrategy
public org.apache.lucene.search.Weight createWeight(org.apache.lucene.search.IndexSearcher searcher) throws IOException
createWeight
in class org.apache.lucene.search.Query
IOException
public org.apache.lucene.search.Query rewrite(org.apache.lucene.index.IndexReader reader) throws IOException
MatchAllDocsQuery
it returns a ConstantScoreQuery
. Otherwise
it returns a new FilteredQuery
wrapping the rewritten query.rewrite
in class org.apache.lucene.search.Query
IOException
public void setBoost(float b)
setBoost
in class org.apache.lucene.search.Query
public float getBoost()
getBoost
in class org.apache.lucene.search.Query
public final org.apache.lucene.search.Query getQuery()
public final org.apache.lucene.search.Filter getFilter()
public void extractTerms(Set<org.apache.lucene.index.Term> terms)
extractTerms
in class org.apache.lucene.search.Query
public String toString(String s)
toString
in class org.apache.lucene.search.Query
public boolean equals(Object o)
o
is equal to this.equals
in class org.apache.lucene.search.Query
public int hashCode()
hashCode
in class org.apache.lucene.search.Query
public org.apache.lucene.search.Query clone()
clone
in class org.apache.lucene.search.Query
Copyright © 2009–2015. All rights reserved.