jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1142985 - /jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
Date Tue, 05 Jul 2011 11:11:09 GMT
Author: alexparvulescu
Date: Tue Jul  5 11:11:09 2011
New Revision: 1142985

URL: http://svn.apache.org/viewvc?rev=1142985&view=rev
Log:
2.2 rollback (JCR-2918 Avoid unnecessary index reader calls when using aggregate definitions)

Modified:
    jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java

Modified: jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java?rev=1142985&r1=1142984&r2=1142985&view=diff
==============================================================================
--- jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
(original)
+++ jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
Tue Jul  5 11:11:09 2011
@@ -1491,46 +1491,45 @@ public class SearchIndex extends Abstrac
      */
     protected void retrieveAggregateRoot(
             Set<NodeId> removedIds, Map<NodeId, NodeState> map) {
-        if(removedIds.isEmpty() || indexingConfig == null){
-            return;
-        }
-        AggregateRule[] aggregateRules = indexingConfig.getAggregateRules();
-        if (aggregateRules == null) {
-            return;
-        }
-        int found = 0;
-        long time = System.currentTimeMillis();
-        try {
-            CachingMultiIndexReader reader = index.getIndexReader();
+        if (indexingConfig != null) {
+            AggregateRule[] aggregateRules = indexingConfig.getAggregateRules();
+            if (aggregateRules == null) {
+                return;
+            }
+            int found = 0;
+            long time = System.currentTimeMillis();
             try {
-                Term aggregateIds =
-                    new Term(FieldNames.AGGREGATED_NODE_UUID, "");
-                TermDocs tDocs = reader.termDocs();
+                CachingMultiIndexReader reader = index.getIndexReader();
                 try {
-                    ItemStateManager ism = getContext().getItemStateManager();
-                    for (NodeId id : removedIds) {
-                        aggregateIds =
-                            aggregateIds.createTerm(id.toString());
-                        tDocs.seek(aggregateIds);
-                        while (tDocs.next()) {
-                            Document doc = reader.document(
-                                    tDocs.doc(), FieldSelectors.UUID);
-                            NodeId nId = new NodeId(doc.get(FieldNames.UUID));
-                            map.put(nId, (NodeState) ism.getItemState(nId));
-                            found++;
+                    Term aggregateIds =
+                        new Term(FieldNames.AGGREGATED_NODE_UUID, "");
+                    TermDocs tDocs = reader.termDocs();
+                    try {
+                        ItemStateManager ism = getContext().getItemStateManager();
+                        for (NodeId id : removedIds) {
+                            aggregateIds =
+                                aggregateIds.createTerm(id.toString());
+                            tDocs.seek(aggregateIds);
+                            while (tDocs.next()) {
+                                Document doc = reader.document(
+                                        tDocs.doc(), FieldSelectors.UUID);
+                                NodeId nId = new NodeId(doc.get(FieldNames.UUID));
+                                map.put(nId, (NodeState) ism.getItemState(nId));
+                                found++;
+                            }
                         }
+                    } finally {
+                        tDocs.close();
                     }
                 } finally {
-                    tDocs.close();
+                    reader.release();
                 }
-            } finally {
-                reader.release();
+            } catch (Exception e) {
+                log.warn("Exception while retrieving aggregate roots", e);
             }
-        } catch (Exception e) {
-            log.warn("Exception while retrieving aggregate roots", e);
+            time = System.currentTimeMillis() - time;
+            log.debug("Retrieved {} aggregate roots in {} ms.", found, time);
         }
-        time = System.currentTimeMillis() - time;
-        log.debug("Retrieved {} aggregate roots in {} ms.", found, time);
     }
 
     //----------------------------< internal >----------------------------------



Mime
View raw message