From 2e93329e230b633fc52695081c91795da71d92ca Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Fri, 29 Mar 2013 16:57:42 +0100 Subject: [PATCH] If match then go to next doc --- .../common/lucene/search/XBooleanFilter.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/elasticsearch/common/lucene/search/XBooleanFilter.java b/src/main/java/org/elasticsearch/common/lucene/search/XBooleanFilter.java index 709b86100d7..1744a64b402 100644 --- a/src/main/java/org/elasticsearch/common/lucene/search/XBooleanFilter.java +++ b/src/main/java/org/elasticsearch/common/lucene/search/XBooleanFilter.java @@ -241,17 +241,14 @@ public class XBooleanFilter extends Filter implements Iterable { // should filter. TODO: Add an option to have disable minimum_should_match=1 behaviour if (!orClauses.isEmpty()) { DocIdSetIterator it = res.iterator(); - for (int setDoc = it.nextDoc(); setDoc != DocIdSetIterator.NO_MORE_DOCS; setDoc = it.nextDoc()) { - boolean match = false; + res: for (int setDoc = it.nextDoc(); setDoc != DocIdSetIterator.NO_MORE_DOCS; setDoc = it.nextDoc()) { for (ResultClause orClause : orClauses) { if (orClause.bits.get(setDoc)) { - match = true; hasNonEmptyShouldClause = true; + continue res; } } - if (!match) { - res.clear(setDoc); - } + res.clear(setDoc); } }