From 7b9856b7d213cd38d9de47f87eb6413e363b72f1 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Mon, 10 Aug 2009 15:29:55 +0000 Subject: [PATCH] LUCENE-1784: make Weight impls for BooleanQuery & DisjunctionMaxQuery protected to permit expert subclassing git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@802825 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/lucene/search/BooleanQuery.java | 12 +++++++++++- .../lucene/search/DisjunctionMaxQuery.java | 16 ++++++++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/java/org/apache/lucene/search/BooleanQuery.java b/src/java/org/apache/lucene/search/BooleanQuery.java index b156a7bf62e..52b1fd04ed3 100644 --- a/src/java/org/apache/lucene/search/BooleanQuery.java +++ b/src/java/org/apache/lucene/search/BooleanQuery.java @@ -172,8 +172,18 @@ public class BooleanQuery extends Query { /** Returns the list of clauses in this query. */ public List clauses() { return clauses; } - private class BooleanWeight extends QueryWeight { + /** + * Expert: the Weight for BooleanQuery, used to + * normalize, score and explain these queries. + * + *

NOTE: this API and implementation is subject to + * change suddenly in the next release.

+ */ + protected class BooleanWeight extends QueryWeight { + /** The Similarity implementation. */ protected Similarity similarity; + + /** The Weights for our subqueries, in 1-1 correspondence with clauses */ protected ArrayList weights; public BooleanWeight(Searcher searcher) diff --git a/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java b/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java index 3a0969e3652..93a733ead01 100644 --- a/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java +++ b/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java @@ -85,11 +85,19 @@ public class DisjunctionMaxQuery extends Query { return disjuncts.iterator(); } - /* The Weight for DisjunctionMaxQuery's, used to normalize, score and explain these queries */ - private class DisjunctionMaxWeight extends QueryWeight { + /** + * Expert: the Weight for DisjunctionMaxQuery, used to + * normalize, score and explain these queries. + * + *

NOTE: this API and implementation is subject to + * change suddenly in the next release.

+ */ + protected class DisjunctionMaxWeight extends QueryWeight { + /** The Similarity implementation. */ + protected Similarity similarity; - private Similarity similarity; // The similarity which we are associated. - private ArrayList weights = new ArrayList(); // The Weight's for our subqueries, in 1-1 correspondence with disjuncts + /** The Weights for our subqueries, in 1-1 correspondence with disjuncts */ + protected ArrayList weights = new ArrayList(); /* Construct the Weight for this Query searched by searcher. Recursively construct subquery weights. */ public DisjunctionMaxWeight(Searcher searcher) throws IOException {