r110891 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110890‎ | r110891 | r110892 >
Date:22:53, 7 February 2012
Author:oren
Status:deferred
Tags:
Comment:
added unimplemented method required to conform to Lucene 2.9.4 API
Modified paths:
  • /trunk/lucene-search-3/src/main/java/org/apache/lucene/search/PositionalMultiQuery.java (modified) (history)
  • /trunk/lucene-search-3/src/main/java/org/apache/lucene/search/RelevanceQuery.java (modified) (history)

Diff [purge]

Index: trunk/lucene-search-3/src/main/java/org/apache/lucene/search/PositionalMultiQuery.java
@@ -148,8 +148,7 @@
149149
150150
151151 @Override
152 - public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder,
153 - boolean topScorer) throws IOException {
 152+ public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder, boolean topScorer) throws IOException {
154153
155154 return scorer(reader) ;
156155 }
@@ -188,13 +187,16 @@
189188 options.rankMeta.init(reader,field);
190189
191190 if( tps.length == 1)
192 - return new PositionalScorer.TermScorer(this, tps, getPositions(), stopWordCount,
 191+ return new PositionalScorer.TermScorer(
 192+ this, tps, getPositions(), stopWordCount,
193193 similarity,reader.norms(field), options);
194194 else if( slop == 0 )
195 - return new PositionalScorer.ExactScorer(this, tps, getPositions(), stopWordCount,
 195+ return new PositionalScorer.ExactScorer(
 196+ this, tps, getPositions(), stopWordCount,
196197 similarity, reader.norms(field), options);
197198 else
198 - return new PositionalScorer.SloppyScorer(this, tps, getPositions(), stopWordCount,
 199+ return new PositionalScorer.SloppyScorer(
 200+ this, tps, getPositions(), stopWordCount,
199201 similarity, slop, reader.norms(field), options);
200202 }
201203
Index: trunk/lucene-search-3/src/main/java/org/apache/lucene/search/RelevanceQuery.java
@@ -121,7 +121,7 @@
122122 * Relevance Weight
123123 *
124124 */
125 - protected class RelevanceWeight implements Weight {
 125+ protected class RelevanceWeight extends Weight {
126126 /**
127127 *
128128 */
@@ -174,19 +174,40 @@
175175 }
176176 }
177177
178 - /*(non-Javadoc) @see org.apache.lucene.search.Weight#scorer(org.apache.lucene.index.IndexReader) */
 178+ @Override
 179+ public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder,
 180+ boolean topScorer) throws IOException {
 181+ Scorer mainScorer = mainWeight.scorer(reader,scoreDocsInOrder,topScorer);
 182+ ArrayList<Scorer> relSc = new ArrayList<Scorer>();
 183+ for(Weight wr : relevanceWeight)
 184+ relSc.add(wr.scorer(reader,scoreDocsInOrder,topScorer));
 185+ return new RelevanceScorer(similarity, reader, this, mainScorer, relSc, relevanceWeight);
 186+
 187+ }
 188+
 189+
 190+ /** @see org.apache.lucene.search.Weight#scorer(org.apache.lucene.index.IndexReader)
 191+ *
 192+ * @param reader
 193+ * @return
 194+ * @throws IOException
 195+ */
179196 public Scorer scorer(IndexReader reader) throws IOException {
180 - Scorer mainScorer = mainWeight.scorer(reader);
 197+ Scorer mainScorer = mainWeight.scorer(reader,true,true);
181198 ArrayList<Scorer> relSc = new ArrayList<Scorer>();
182199 for(Weight wr : relevanceWeight)
183 - relSc.add(wr.scorer(reader));
 200+ relSc.add(wr.scorer(reader,true,true));
184201 return new RelevanceScorer(similarity, reader, this, mainScorer, relSc, relevanceWeight);
185202 }
186203
187 - /*(non-Javadoc) @see org.apache.lucene.search.Weight#explain(org.apache.lucene.index.IndexReader, int) */
 204+ /** @see org.apache.lucene.search.Weight#explain(org.apache.lucene.index.IndexReader, int)
 205+ *
 206+ */
188207 public Explanation explain(IndexReader reader, int doc) throws IOException {
189208 return scorer(reader).explain(doc);
190209 }
 210+
 211+
191212 }
192213
193214

Status & tagging log