jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1088991 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryFactory.java
Date Tue, 05 Apr 2011 11:46:18 GMT
Author: jukka
Date: Tue Apr  5 11:46:18 2011
New Revision: 1088991

URL: http://svn.apache.org/viewvc?rev=1088991&view=rev
Log:
JCR-2928: LuceneQueryFactory should call QueryHits.close() after running a query

Patch by Alex Parvulescu

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryFactory.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryFactory.java?rev=1088991&r1=1088990&r2=1088991&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryFactory.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/LuceneQueryFactory.java
Tue Apr  5 11:46:18 2011
@@ -171,6 +171,7 @@ public class LuceneQueryFactory {
             Map<String, PropertyValue> columns, Selector selector,
             Constraint constraint) throws RepositoryException, IOException {
         final IndexReader reader = index.getIndexReader(true);
+        QueryHits hits = null;
         try {
             JackrabbitIndexSearcher searcher = new JackrabbitIndexSearcher(
                     session, reader, index.getContext().getItemStateManager());
@@ -192,7 +193,7 @@ public class LuceneQueryFactory {
             }
 
             List<Row> rows = new ArrayList<Row>();
-            QueryHits hits = searcher.evaluate(qp.mainQuery);
+            hits = searcher.evaluate(qp.mainQuery);
             ScoreNode node = hits.nextScoreNode();
             while (node != null) {
                 try {
@@ -210,6 +211,9 @@ public class LuceneQueryFactory {
             }
             return rows;
         } finally {
+            if(hits != null){
+                hits.close();
+            }
             Util.closeOrRelease(reader);
         }
     }



Mime
View raw message