r110875 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110874‎ | r110875 | r110876 >
Date:21:34, 7 February 2012
Author:oren
Status:deferred
Tags:
Comment:
to conform to Lucene 2.9.4 API
* Weight changed from Interface to Abstract
Modified paths:
  • /trunk/lucene-search-3/src/main/java/org/wikimedia/lsearch/search/MatchAllTitlesQuery.java (modified) (history)

Diff [purge]

Index: trunk/lucene-search-3/src/main/java/org/wikimedia/lsearch/search/MatchAllTitlesQuery.java
@@ -17,6 +17,9 @@
1818 * limitations under the License.
1919 */
2020
 21+import java.io.IOException;
 22+import java.util.Set;
 23+
2124 import org.apache.lucene.index.IndexReader;
2225 import org.apache.lucene.search.ComplexExplanation;
2326 import org.apache.lucene.search.Explanation;
@@ -27,9 +30,6 @@
2831 import org.apache.lucene.search.Weight;
2932 import org.apache.lucene.util.ToStringUtils;
3033
31 -import java.io.IOException;
32 -import java.util.Set;
33 -
3434 /**
3535 * A query that matches all documents, and gets scores from title boost
3636 *
@@ -94,10 +94,28 @@
9595
9696 }
9797
98 - private class MatchAllDocsWeight implements Weight {
 98+ private class MatchAllDocsWeight extends Weight {
 99+
 100+ @Override
 101+ public Scorer scorer(IndexReader reader, boolean arg1, boolean arg2)
 102+ throws IOException {
 103+
 104+ return new MatchAllScorer(reader, similarity, this, reader.norms(titleField));
 105+ }
 106+
99107 /**
100108 *
101 - */
 109+ * @param reader
 110+ * @return
 111+ * @throws IOException
 112+ *
 113+ * @Deprecated
 114+ */
 115+ public Scorer scorer(IndexReader reader) throws IOException {
 116+ return new MatchAllScorer(reader, similarity, this, reader.norms(titleField));
 117+ }
 118+
 119+
102120 private static final long serialVersionUID = 3242930691905297732L;
103121 private Similarity similarity;
104122 private float queryWeight;
@@ -107,18 +125,31 @@
108126 this.similarity = searcher.getSimilarity();
109127 }
110128
 129+ /**
 130+ *
 131+ */
 132+ @Override
111133 public String toString() {
112134 return "weight(" + MatchAllTitlesQuery.this + ")";
113135 }
114 -
 136+ /**
 137+ *
 138+ */
 139+ @Override
115140 public Query getQuery() {
116141 return MatchAllTitlesQuery.this;
117142 }
118 -
 143+ /**
 144+ *
 145+ */
 146+ @Override
119147 public float getValue() {
120148 return queryWeight;
121149 }
122 -
 150+ /**
 151+ *
 152+ */
 153+ @Override
123154 public float sumOfSquaredWeights() {
124155 queryWeight = getBoost();
125156 return queryWeight * queryWeight;
@@ -129,10 +160,9 @@
130161 queryWeight *= this.queryNorm;
131162 }
132163
133 - public Scorer scorer(IndexReader reader) throws IOException {
134 - return new MatchAllScorer(reader, similarity, this, reader.norms(titleField));
135 - }
136164
 165+
 166+ @Override
137167 public Explanation explain(IndexReader reader, int doc) {
138168 // explain query weight
139169 Explanation queryExpl = new ComplexExplanation
@@ -144,9 +174,13 @@
145175
146176 return queryExpl;
147177 }
 178+
 179+
 180+
 181+
148182 }
149183
150 - protected Weight createWeight(Searcher searcher) {
 184+ public Weight createWeight(Searcher searcher) {
151185 return new MatchAllDocsWeight(searcher);
152186 }
153187

Status & tagging log