Index: trunk/lucene-search-3/src/main/java/org/apache/lucene/search/PositionalMultiQuery.java |
— | — | @@ -148,8 +148,7 @@ |
149 | 149 | |
150 | 150 | |
151 | 151 | @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 { |
154 | 153 | |
155 | 154 | return scorer(reader) ; |
156 | 155 | } |
— | — | @@ -188,13 +187,16 @@ |
189 | 188 | options.rankMeta.init(reader,field); |
190 | 189 | |
191 | 190 | if( tps.length == 1) |
192 | | - return new PositionalScorer.TermScorer(this, tps, getPositions(), stopWordCount, |
| 191 | + return new PositionalScorer.TermScorer( |
| 192 | + this, tps, getPositions(), stopWordCount, |
193 | 193 | similarity,reader.norms(field), options); |
194 | 194 | else if( slop == 0 ) |
195 | | - return new PositionalScorer.ExactScorer(this, tps, getPositions(), stopWordCount, |
| 195 | + return new PositionalScorer.ExactScorer( |
| 196 | + this, tps, getPositions(), stopWordCount, |
196 | 197 | similarity, reader.norms(field), options); |
197 | 198 | else |
198 | | - return new PositionalScorer.SloppyScorer(this, tps, getPositions(), stopWordCount, |
| 199 | + return new PositionalScorer.SloppyScorer( |
| 200 | + this, tps, getPositions(), stopWordCount, |
199 | 201 | similarity, slop, reader.norms(field), options); |
200 | 202 | } |
201 | 203 | |
Index: trunk/lucene-search-3/src/main/java/org/apache/lucene/search/RelevanceQuery.java |
— | — | @@ -121,7 +121,7 @@ |
122 | 122 | * Relevance Weight |
123 | 123 | * |
124 | 124 | */ |
125 | | - protected class RelevanceWeight implements Weight { |
| 125 | + protected class RelevanceWeight extends Weight { |
126 | 126 | /** |
127 | 127 | * |
128 | 128 | */ |
— | — | @@ -174,19 +174,40 @@ |
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
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 | + */ |
179 | 196 | public Scorer scorer(IndexReader reader) throws IOException { |
180 | | - Scorer mainScorer = mainWeight.scorer(reader); |
| 197 | + Scorer mainScorer = mainWeight.scorer(reader,true,true); |
181 | 198 | ArrayList<Scorer> relSc = new ArrayList<Scorer>(); |
182 | 199 | for(Weight wr : relevanceWeight) |
183 | | - relSc.add(wr.scorer(reader)); |
| 200 | + relSc.add(wr.scorer(reader,true,true)); |
184 | 201 | return new RelevanceScorer(similarity, reader, this, mainScorer, relSc, relevanceWeight); |
185 | 202 | } |
186 | 203 | |
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 | + */ |
188 | 207 | public Explanation explain(IndexReader reader, int doc) throws IOException { |
189 | 208 | return scorer(reader).explain(doc); |
190 | 209 | } |
| 210 | + |
| 211 | + |
191 | 212 | } |
192 | 213 | |
193 | 214 | |