From d450d3b016983ee22eb97ef72a03b7fca923772c Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Thu, 8 Aug 2013 11:33:06 +0200 Subject: [PATCH] Simplified checks --- .../java/org/elasticsearch/percolator/PercolatorService.java | 4 +--- .../java/org/elasticsearch/percolator/QueryCollector.java | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/elasticsearch/percolator/PercolatorService.java b/src/main/java/org/elasticsearch/percolator/PercolatorService.java index eeabdc7aece..d00a1b280ab 100644 --- a/src/main/java/org/elasticsearch/percolator/PercolatorService.java +++ b/src/main/java/org/elasticsearch/percolator/PercolatorService.java @@ -100,9 +100,7 @@ public class PercolatorService extends AbstractComponent { } if (collector.exists()) { - if (!context.limit) { - matches.add(entry.getKey()); - } else if (count < context.size) { + if (!context.limit || count < context.size) { matches.add(entry.getKey()); } count++; diff --git a/src/main/java/org/elasticsearch/percolator/QueryCollector.java b/src/main/java/org/elasticsearch/percolator/QueryCollector.java index 034d72606ab..f983e846433 100644 --- a/src/main/java/org/elasticsearch/percolator/QueryCollector.java +++ b/src/main/java/org/elasticsearch/percolator/QueryCollector.java @@ -99,9 +99,7 @@ abstract class QueryCollector extends Collector { collector.reset(); searcher.search(query, collector); if (collector.exists()) { - if (!limit) { - matches.add(id); - } else if (counter < size) { + if (!limit || counter < size) { matches.add(id); } counter++;