Methods Summary |
---|
public java.lang.Object | clone()Returns a clone of this query.
try {
return (Query)super.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException("Clone not supported: " + e.getMessage());
}
|
public org.apache.lucene.search.Query | combine(org.apache.lucene.search.Query[] queries)Expert: called when re-writing queries under MultiSearcher.
Only implemented by derived queries, with no
{@link #createWeight(Searcher)} implementatation.
throw new UnsupportedOperationException();
|
protected org.apache.lucene.search.Weight | createWeight(org.apache.lucene.search.Searcher searcher)Expert: Constructs an appropriate Weight implementation for this query.
Only implemented by primitive queries, which re-write to themselves.
throw new UnsupportedOperationException();
|
public float | getBoost()Gets the boost for this clause. Documents matching
this clause will (in addition to the normal weightings) have their score
multiplied by b . The boost is 1.0 by default. return boost;
|
public org.apache.lucene.search.Similarity | getSimilarity(org.apache.lucene.search.Searcher searcher)Expert: Returns the Similarity implementation to be used for this query.
Subclasses may override this method to specify their own Similarity
implementation, perhaps one that delegates through that of the Searcher.
By default the Searcher's Similarity implementation is returned.
return searcher.getSimilarity();
|
public static org.apache.lucene.search.Query | mergeBooleanQueries(org.apache.lucene.search.Query[] queries)Expert: merges the clauses of a set of BooleanQuery's into a single
BooleanQuery.
A utility for use by {@link #combine(Query[])} implementations.
HashSet allClauses = new HashSet();
for (int i = 0; i < queries.length; i++) {
BooleanClause[] clauses = ((BooleanQuery)queries[i]).getClauses();
for (int j = 0; j < clauses.length; j++) {
allClauses.add(clauses[j]);
}
}
BooleanQuery result = new BooleanQuery();
Iterator i = allClauses.iterator();
while (i.hasNext()) {
result.add((BooleanClause)i.next());
}
return result;
|
public org.apache.lucene.search.Query | rewrite(org.apache.lucene.index.IndexReader reader)Expert: called to re-write queries into primitive queries.
return this;
|
public void | setBoost(float b)Sets the boost for this query clause to b . Documents
matching this clause will (in addition to the normal weightings) have
their score multiplied by b . // query boost factor
boost = b;
|
public abstract java.lang.String | toString(java.lang.String field)Prints a query to a string, with field as the default field
for terms. The representation used is one that is readable by
{@link org.apache.lucene.queryParser.QueryParser QueryParser}
(although, if the query was created by the parser, the printed
representation may not be exactly what was parsed).
|
public java.lang.String | toString()Prints a query to a string.
return toString("");
|
public org.apache.lucene.search.Weight | weight(org.apache.lucene.search.Searcher searcher)Expert: Constructs an initializes a Weight for a top-level query.
Query query = searcher.rewrite(this);
Weight weight = query.createWeight(searcher);
float sum = weight.sumOfSquaredWeights();
float norm = getSimilarity(searcher).queryNorm(sum);
weight.normalize(norm);
return weight;
|