From 7cccacbcfaeab9cdf16229b7c72469c4efcf72f9 Mon Sep 17 00:00:00 2001 From: kimchy Date: Fri, 6 May 2011 23:10:21 +0300 Subject: [PATCH] guard in boolean filter from null doc id sets and iterators --- .../common/lucene/search/XBooleanFilter.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/search/XBooleanFilter.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/search/XBooleanFilter.java index 5023b5e7bb8..e490e869bd1 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/search/XBooleanFilter.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/search/XBooleanFilter.java @@ -41,7 +41,15 @@ public class XBooleanFilter extends Filter { private DocIdSetIterator getDISI(ArrayList filters, int index, IndexReader reader) throws IOException { - return filters.get(index).getDocIdSet(reader).iterator(); + DocIdSet docIdSet = filters.get(index).getDocIdSet(reader); + if (docIdSet == null) { + return DocIdSet.EMPTY_DOCIDSET.iterator(); + } + DocIdSetIterator iterator = docIdSet.iterator(); + if (iterator == null) { + return DocIdSet.EMPTY_DOCIDSET.iterator(); + } + return iterator; } public List getShouldFilters() {