|
21 | 21 |
|
22 | 22 | import org.apache.lucene.analysis.TokenStream;
|
23 | 23 | import org.apache.lucene.document.Fieldable;
|
24 |
| -import org.apache.lucene.index.IndexReader; |
25 | 24 | import org.apache.lucene.index.memory.MemoryIndex;
|
26 |
| -import org.apache.lucene.search.Collector; |
27 | 25 | import org.apache.lucene.search.IndexSearcher;
|
28 | 26 | import org.apache.lucene.search.Query;
|
29 |
| -import org.apache.lucene.search.Scorer; |
30 | 27 | import org.elasticsearch.ElasticSearchException;
|
31 | 28 | import org.elasticsearch.common.collect.ImmutableMap;
|
32 | 29 | import org.elasticsearch.common.collect.MapBuilder;
|
33 | 30 | import org.elasticsearch.common.inject.Inject;
|
34 | 31 | import org.elasticsearch.common.io.FastByteArrayOutputStream;
|
35 | 32 | import org.elasticsearch.common.io.FastStringReader;
|
| 33 | +import org.elasticsearch.common.lucene.Lucene; |
36 | 34 | import org.elasticsearch.common.regex.Regex;
|
37 | 35 | import org.elasticsearch.common.settings.Settings;
|
38 | 36 | import org.elasticsearch.index.AbstractIndexComponent;
|
@@ -196,7 +194,7 @@ public Response percolate(Request request) throws ElasticSearchException {
|
196 | 194 | }
|
197 | 195 | }
|
198 | 196 |
|
199 |
| - ExistsCollector collector = new ExistsCollector(); |
| 197 | + Lucene.ExistsCollector collector = new Lucene.ExistsCollector(); |
200 | 198 | List<String> matches = new ArrayList<String>();
|
201 | 199 | IndexSearcher searcher = memoryIndex.createSearcher();
|
202 | 200 | for (Map.Entry<String, Query> entry : queries.entrySet()) {
|
@@ -224,56 +222,4 @@ public Response percolate(Request request) throws ElasticSearchException {
|
224 | 222 |
|
225 | 223 | return new Response(matches, doc.mappersAdded());
|
226 | 224 | }
|
227 |
| - |
228 |
| - static class ExistsCollector extends Collector { |
229 |
| - |
230 |
| - private boolean exists; |
231 |
| - |
232 |
| - public boolean exists() { |
233 |
| - return exists; |
234 |
| - } |
235 |
| - |
236 |
| - @Override public void setScorer(Scorer scorer) throws IOException { |
237 |
| - this.exists = false; |
238 |
| - } |
239 |
| - |
240 |
| - @Override public void collect(int doc) throws IOException { |
241 |
| - exists = true; |
242 |
| - } |
243 |
| - |
244 |
| - @Override public void setNextReader(IndexReader reader, int docBase) throws IOException { |
245 |
| - } |
246 |
| - |
247 |
| - @Override public boolean acceptsDocsOutOfOrder() { |
248 |
| - return true; |
249 |
| - } |
250 |
| - } |
251 |
| - |
252 |
| - |
253 |
| - static class SingleScoreCollector extends Collector { |
254 |
| - |
255 |
| - private Scorer scorer; |
256 |
| - |
257 |
| - private float score; |
258 |
| - |
259 |
| - public float score() { |
260 |
| - return this.score; |
261 |
| - } |
262 |
| - |
263 |
| - @Override public void setScorer(Scorer scorer) throws IOException { |
264 |
| - this.score = 0; |
265 |
| - this.scorer = scorer; |
266 |
| - } |
267 |
| - |
268 |
| - @Override public void collect(int doc) throws IOException { |
269 |
| - score = scorer.score(); |
270 |
| - } |
271 |
| - |
272 |
| - @Override public void setNextReader(IndexReader reader, int docBase) throws IOException { |
273 |
| - } |
274 |
| - |
275 |
| - @Override public boolean acceptsDocsOutOfOrder() { |
276 |
| - return true; |
277 |
| - } |
278 |
| - } |
279 | 225 | }
|
0 commit comments