You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ch...@apache.org on 2015/04/11 08:21:55 UTC

svn commit: r1672839 - in /jackrabbit/oak/branches/1.2: ./ oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java

Author: chetanm
Date: Sat Apr 11 06:21:55 2015
New Revision: 1672839

URL: http://svn.apache.org/r1672839
Log:
OAK-2753 - Use increasing batch size for sorted queries in LucenePropertyIndex

Merging 1672835

Modified:
    jackrabbit/oak/branches/1.2/   (props changed)
    jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java

Propchange: jackrabbit/oak/branches/1.2/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Apr 11 06:21:55 2015
@@ -1,3 +1,3 @@
 /jackrabbit/oak/branches/1.0:1665962
-/jackrabbit/oak/trunk:1672350,1672468,1672537,1672603,1672834
+/jackrabbit/oak/trunk:1672350,1672468,1672537,1672603,1672834-1672835
 /jackrabbit/trunk:1345480

Modified: jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java?rev=1672839&r1=1672838&r2=1672839&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java (original)
+++ jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java Sat Apr 11 06:21:55 2015
@@ -64,6 +64,7 @@ import org.apache.jackrabbit.oak.spi.que
 import org.apache.jackrabbit.oak.spi.query.QueryIndex;
 import org.apache.jackrabbit.oak.spi.query.QueryIndex.AdvanceFulltextQueryIndex;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.apache.jackrabbit.oak.util.PerfLogger;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.FieldInfo;
@@ -161,6 +162,8 @@ public class LucenePropertyIndex impleme
 
     private static final Logger LOG = LoggerFactory
             .getLogger(LucenePropertyIndex.class);
+    private static final PerfLogger PERF_LOGGER =
+            new PerfLogger(LoggerFactory.getLogger(LucenePropertyIndex.class.getName() + ".perf"));
 
     static final String ATTR_PLAN_RESULT = "oak.lucene.planResult";
 
@@ -326,24 +329,23 @@ public class LucenePropertyIndex impleme
                         }
 
                         TopDocs docs;
-                        long time = System.currentTimeMillis();
+                        long start = PERF_LOGGER.start();
                         if (lastDoc != null) {
                             LOG.debug("loading the next {} entries for query {}", nextBatchSize, query);
                             if (sort == null) {
                                 docs = searcher.searchAfter(lastDoc, query, nextBatchSize);
                             } else {
-                                docs = searcher.searchAfter(lastDoc, query, LUCENE_QUERY_BATCH_SIZE, sort);
+                                docs = searcher.searchAfter(lastDoc, query, nextBatchSize, sort);
                             }
                         } else {
                             LOG.debug("loading the first {} entries for query {}", nextBatchSize, query);
                             if (sort == null) {
                                 docs = searcher.search(query, nextBatchSize);
                             } else {
-                                docs = searcher.search(query, LUCENE_QUERY_BATCH_SIZE, sort);
+                                docs = searcher.search(query, nextBatchSize, sort);
                             }
                         }
-                        time = System.currentTimeMillis() - time;
-                        LOG.debug("... took {} ms", time);
+                        PERF_LOGGER.end(start, -1, "...");
                         nextBatchSize = (int) Math.min(nextBatchSize * 2L, 100000);
 
                         for (ScoreDoc doc : docs.scoreDocs) {
@@ -1148,6 +1150,7 @@ public class LucenePropertyIndex impleme
                 }
 
             };
+            //TODO should not use distinct
             pathCursor = new PathCursor(pathIterator, true, settings);
         }