LUCENE-2687: Remove pq trap in MultiTermQuery.TopTermsBooleanQueryRewrite

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1005310 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2010-10-07 01:18:30 +00:00
parent 42d5b585ce
commit 51d4dcd582
4 changed files with 3 additions and 28 deletions

View File

@ -682,8 +682,7 @@ Optimizations
* LUCENE-2123, LUCENE-2261: Move FuzzyQuery rewrite to separate RewriteMode * LUCENE-2123, LUCENE-2261: Move FuzzyQuery rewrite to separate RewriteMode
into MultiTermQuery. The number of fuzzy expansions can be specified with into MultiTermQuery. The number of fuzzy expansions can be specified with
the maxExpansions parameter to FuzzyQuery, but the default is limited to the maxExpansions parameter to FuzzyQuery.
BooleanQuery.maxClauseCount() as before.
(Uwe Schindler, Robert Muir, Mike McCandless) (Uwe Schindler, Robert Muir, Mike McCandless)
* LUCENE-2164: ConcurrentMergeScheduler has more control over merge * LUCENE-2164: ConcurrentMergeScheduler has more control over merge

View File

@ -283,14 +283,6 @@ public abstract class MultiTermQuery extends Query {
this.size = size; this.size = size;
} }
/**
* Create a TopTermsBooleanQueryRewrite that is limited
* to at most {@link BooleanQuery#getMaxClauseCount} terms.
*/
public TopTermsBooleanQueryRewrite() {
this(Integer.MAX_VALUE);
}
/** Return a suitable Query for a MultiTermQuery term. */ /** Return a suitable Query for a MultiTermQuery term. */
protected abstract Query getQuery(Term term, int docCount); protected abstract Query getQuery(Term term, int docCount);
@ -379,14 +371,6 @@ public abstract class MultiTermQuery extends Query {
public static final class TopTermsScoringBooleanQueryRewrite extends public static final class TopTermsScoringBooleanQueryRewrite extends
TopTermsBooleanQueryRewrite { TopTermsBooleanQueryRewrite {
/**
* Create a TopTermsScoringBooleanQueryRewrite that is limited
* to at most {@link BooleanQuery#getMaxClauseCount} terms.
*/
public TopTermsScoringBooleanQueryRewrite() {
super();
}
/** /**
* Create a TopTermsScoringBooleanQueryRewrite for * Create a TopTermsScoringBooleanQueryRewrite for
* at most <code>size</code> terms. * at most <code>size</code> terms.
@ -417,14 +401,6 @@ public abstract class MultiTermQuery extends Query {
public static final class TopTermsBoostOnlyBooleanQueryRewrite extends public static final class TopTermsBoostOnlyBooleanQueryRewrite extends
TopTermsBooleanQueryRewrite { TopTermsBooleanQueryRewrite {
/**
* Create a TopTermsBoostOnlyBooleanQueryRewrite that is limited
* to at most {@link BooleanQuery#getMaxClauseCount} terms.
*/
public TopTermsBoostOnlyBooleanQueryRewrite() {
super();
}
/** /**
* Create a TopTermsBoostOnlyBooleanQueryRewrite for * Create a TopTermsBoostOnlyBooleanQueryRewrite for
* at most <code>size</code> terms. * at most <code>size</code> terms.

View File

@ -329,7 +329,7 @@ public class TestFuzzyQuery extends LuceneTestCase {
writer.close(); writer.close();
FuzzyQuery query = new FuzzyQuery(new Term("field", "lucene")); FuzzyQuery query = new FuzzyQuery(new Term("field", "lucene"));
query.setRewriteMethod(new MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite()); query.setRewriteMethod(new MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite(50));
ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs; ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
assertEquals(3, hits.length); assertEquals(3, hits.length);
// normally, 'Lucenne' would be the first result as IDF will skew the score. // normally, 'Lucenne' would be the first result as IDF will skew the score.

View File

@ -138,7 +138,7 @@ public class TestTermRangeQuery extends LuceneTestCase {
} }
private void checkBooleanTerms(Searcher searcher, TermRangeQuery query, String... terms) throws IOException { private void checkBooleanTerms(Searcher searcher, TermRangeQuery query, String... terms) throws IOException {
query.setRewriteMethod(new MultiTermQuery.TopTermsScoringBooleanQueryRewrite()); query.setRewriteMethod(new MultiTermQuery.TopTermsScoringBooleanQueryRewrite(50));
final BooleanQuery bq = (BooleanQuery) searcher.rewrite(query); final BooleanQuery bq = (BooleanQuery) searcher.rewrite(query);
final Set<String> allowedTerms = new HashSet<String>(Arrays.asList(terms)); final Set<String> allowedTerms = new HashSet<String>(Arrays.asList(terms));
assertEquals(allowedTerms.size(), bq.clauses().size()); assertEquals(allowedTerms.size(), bq.clauses().size());