r110884 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110883‎ | r110884 | r110885 >
Date:22:21, 7 February 2012
Author:oren
Status:deferred
Tags:
Comment:
added unimplemented method required to conform to Lucene 2.9.4 API
and deprecated to old one
Modified paths:
  • /trunk/lucene-search-3/src/main/java/org/apache/lucene/search/CustomBoostQuery.java (modified) (history)

Diff [purge]

Index: trunk/lucene-search-3/src/main/java/org/apache/lucene/search/CustomBoostQuery.java
@@ -23,13 +23,6 @@
2424 import java.util.Set;
2525
2626 import org.apache.lucene.index.IndexReader;
27 -import org.apache.lucene.search.ComplexExplanation;
28 -import org.apache.lucene.search.Explanation;
29 -import org.apache.lucene.search.Query;
30 -import org.apache.lucene.search.Scorer;
31 -import org.apache.lucene.search.Searcher;
32 -import org.apache.lucene.search.Similarity;
33 -import org.apache.lucene.search.Weight;
3427 import org.apache.lucene.util.ToStringUtils;
3528
3629 /**
@@ -91,7 +84,11 @@
9285 return this;
9386 }
9487
95 - /*(non-Javadoc) @see org.apache.lucene.search.Query#extractTerms(java.util.Set) */
 88+ /**
 89+ * @see org.apache.lucene.search.Query#extractTerms(java.util.Set)
 90+ *
 91+ */
 92+ @Override
9693 public void extractTerms(Set terms) {
9794 subQuery.extractTerms(terms);
9895 if (boostQuery!=null) {
@@ -179,7 +176,7 @@
180177 }
181178 //=========================== W E I G H T ============================
182179
183 - protected class CustomWeight implements Weight {
 180+ protected class CustomWeight extends Weight {
184181 /**
185182 *
186183 */
@@ -198,17 +195,24 @@
199196 this.similarity = getSimilarity(searcher);
200197 }
201198
202 - /*(non-Javadoc) @see org.apache.lucene.search.Weight#getQuery() */
 199+ /**
 200+ * @see org.apache.lucene.search.Weight#getQuery()
 201+ *
 202+ */
203203 public Query getQuery() {
204204 return CustomBoostQuery.this;
205205 }
206206
207 - /*(non-Javadoc) @see org.apache.lucene.search.Weight#getValue() */
 207+ /**
 208+ * @see org.apache.lucene.search.Weight#getValue()
 209+ */
208210 public float getValue() {
209211 return getBoost();
210212 }
211213
212 - /*(non-Javadoc) @see org.apache.lucene.search.Weight#sumOfSquaredWeights() */
 214+ /**
 215+ * @see org.apache.lucene.search.Weight#sumOfSquaredWeights()
 216+ */
213217 public float sumOfSquaredWeights() throws IOException {
214218 float sum = subQueryWeight.sumOfSquaredWeights();
215219 if (boostWeight!=null) {
@@ -222,7 +226,10 @@
223227 return sum ;
224228 }
225229
226 - /*(non-Javadoc) @see org.apache.lucene.search.Weight#normalize(float) */
 230+ /**
 231+ * @see org.apache.lucene.search.Weight#normalize(float)
 232+ *
 233+ */
227234 public void normalize(float norm) {
228235 norm *= getBoost(); // incorporate boost
229236 subQueryWeight.normalize(norm);
@@ -234,18 +241,42 @@
235242 }
236243 }
237244 }
238 -
239 - /*(non-Javadoc) @see org.apache.lucene.search.Weight#scorer(org.apache.lucene.index.IndexReader) */
 245+ /**
 246+ * @see org.apache.lucene.search.Weight#scorer(IndexReader, boolean, boolean)
 247+ */
 248+ @Override
 249+ public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder, boolean topScorer) throws IOException {
 250+ Scorer subQueryScorer = subQueryWeight.scorer(reader,scoreDocsInOrder,topScorer);
 251+ Scorer boostScorer = (boostWeight==null ? null : boostWeight.scorer(reader,scoreDocsInOrder,topScorer));
 252+ return new CustomScorer(similarity, reader, this, subQueryScorer, boostScorer);
 253+ }
 254+
 255+ /**
 256+ * @see org.apache.lucene.search.Weight#scorer(org.apache.lucene.index.IndexReader)
 257+ *
 258+ * @param reader
 259+ * @return
 260+ * @throws IOException
 261+ *
 262+ * @Deprecated
 263+ */
240264 public Scorer scorer(IndexReader reader) throws IOException {
241 - Scorer subQueryScorer = subQueryWeight.scorer(reader);
242 - Scorer boostScorer = (boostWeight==null ? null : boostWeight.scorer(reader));
 265+ boolean scoreDocsInOrder=true;
 266+ boolean topScorer=true;
 267+ Scorer subQueryScorer = subQueryWeight.scorer(reader,scoreDocsInOrder,topScorer);
 268+ Scorer boostScorer = (boostWeight==null ? null : boostWeight.scorer(reader,scoreDocsInOrder,topScorer));
243269 return new CustomScorer(similarity, reader, this, subQueryScorer, boostScorer);
244270 }
245271
246 - /*(non-Javadoc) @see org.apache.lucene.search.Weight#explain(org.apache.lucene.index.IndexReader, int) */
 272+ /**
 273+ * @see org.apache.lucene.search.Weight#explain(org.apache.lucene.index.IndexReader, int)
 274+ *
 275+ */
247276 public Explanation explain(IndexReader reader, int doc) throws IOException {
248277 return scorer(reader).explain(doc);
249278 }
 279+
 280+
250281 }
251282
252283

Status & tagging log