fix cleanup of of has child/parent

check if the collected uids were processed before trying to push them back to the cache
This commit is contained in:
Shay Banon 2012-09-14 15:01:21 +02:00
parent 3cd54fc4ee
commit 7bf233a174
2 changed files with 10 additions and 3 deletions

View File

@ -140,7 +140,9 @@ public abstract class HasChildFilter extends Filter implements ScopePhase.Collec
} }
public void clear() { public void clear() {
CacheRecycler.pushHashSet(collectedUids); if (collectedUids != null) {
CacheRecycler.pushHashSet(collectedUids);
}
collectedUids = null; collectedUids = null;
} }

View File

@ -21,7 +21,10 @@ package org.elasticsearch.index.search.child;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.apache.lucene.index.IndexReader; 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.apache.lucene.util.FixedBitSet;
import org.elasticsearch.ElasticSearchIllegalStateException; import org.elasticsearch.ElasticSearchIllegalStateException;
import org.elasticsearch.common.CacheRecycler; import org.elasticsearch.common.CacheRecycler;
@ -107,7 +110,9 @@ public abstract class HasParentFilter extends Filter implements ScopePhase.Colle
} }
public void clear() { public void clear() {
CacheRecycler.pushHashSet(parents); if (parents != null) {
CacheRecycler.pushHashSet(parents);
}
parents = null; parents = null;
} }