From 7bf233a174d5833adaf7ab018c601796060e3eb8 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Fri, 14 Sep 2012 15:01:21 +0200 Subject: [PATCH] fix cleanup of of has child/parent check if the collected uids were processed before trying to push them back to the cache --- .../elasticsearch/index/search/child/HasChildFilter.java | 4 +++- .../index/search/child/HasParentFilter.java | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/elasticsearch/index/search/child/HasChildFilter.java b/src/main/java/org/elasticsearch/index/search/child/HasChildFilter.java index ff74f455693..f4106e9b38f 100644 --- a/src/main/java/org/elasticsearch/index/search/child/HasChildFilter.java +++ b/src/main/java/org/elasticsearch/index/search/child/HasChildFilter.java @@ -140,7 +140,9 @@ public abstract class HasChildFilter extends Filter implements ScopePhase.Collec } public void clear() { - CacheRecycler.pushHashSet(collectedUids); + if (collectedUids != null) { + CacheRecycler.pushHashSet(collectedUids); + } collectedUids = null; } diff --git a/src/main/java/org/elasticsearch/index/search/child/HasParentFilter.java b/src/main/java/org/elasticsearch/index/search/child/HasParentFilter.java index 9ef3d0ef553..dc5a8d72bc1 100644 --- a/src/main/java/org/elasticsearch/index/search/child/HasParentFilter.java +++ b/src/main/java/org/elasticsearch/index/search/child/HasParentFilter.java @@ -21,7 +21,10 @@ package org.elasticsearch.index.search.child; import gnu.trove.set.hash.THashSet; import org.apache.lucene.index.IndexReader; -import org.apache.lucene.search.*; +import org.apache.lucene.search.Collector; +import org.apache.lucene.search.DocIdSet; +import org.apache.lucene.search.Filter; +import org.apache.lucene.search.Query; import org.apache.lucene.util.FixedBitSet; import org.elasticsearch.ElasticSearchIllegalStateException; import org.elasticsearch.common.CacheRecycler; @@ -107,7 +110,9 @@ public abstract class HasParentFilter extends Filter implements ScopePhase.Colle } public void clear() { - CacheRecycler.pushHashSet(parents); + if (parents != null) { + CacheRecycler.pushHashSet(parents); + } parents = null; }