Skip to content

Commit

Permalink
reuse exists collector
Browse files Browse the repository at this point in the history
  • Loading branch information
kimchy committed May 16, 2011
1 parent 739c92b commit 70e8698
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,10 @@ public static class ExistsCollector extends Collector {

private boolean exists;

public void reset() {
exists = false;
}

public boolean exists() {
return exists;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,9 @@ public Response percolate(DocAndQueryRequest request) throws ElasticSearchExcept

List<String> matches = new ArrayList<String>();
if (request.query() == null) {
Lucene.ExistsCollector collector = new Lucene.ExistsCollector();
for (Map.Entry<String, Query> entry : queries.entrySet()) {
Lucene.ExistsCollector collector = new Lucene.ExistsCollector();
collector.reset();
try {
searcher.search(entry.getValue(), collector);
} catch (IOException e) {
Expand Down

0 comments on commit 70e8698

Please sign in to comment.