Browse Source

Release parentDocs in TopChildrenQuery.

Martijn van Groningen 12 years ago
parent
commit
9c67be5181

+ 3 - 1
src/main/java/org/elasticsearch/index/search/child/TopChildrenQuery.java

@@ -145,7 +145,9 @@ public class TopChildrenQuery extends Query {
             }
             }
         }
         }
 
 
-        return new ParentWeight(rewrittenChildQuery.createWeight(searcher), parentDocs);
+        ParentWeight parentWeight =  new ParentWeight(rewrittenChildQuery.createWeight(searcher), parentDocs);
+        searchContext.addReleasable(parentWeight);
+        return parentWeight;
     }
     }
 
 
     int resolveParentDocuments(TopDocs topDocs, SearchContext context, Recycler.V<ObjectObjectOpenHashMap<Object, ParentDoc[]>> parentDocs) {
     int resolveParentDocuments(TopDocs topDocs, SearchContext context, Recycler.V<ObjectObjectOpenHashMap<Object, ParentDoc[]>> parentDocs) {