Author: chetanm
Date: Sat Apr 11 06:11:57 2015
New Revision: 1672835
URL: http://svn.apache.org/r1672835
Log:
OAK-2753 - Use increasing batch size for sorted queries in LucenePropertyIndex
-- Change the batch size to the increasing one from current fixed one
-- Switched to PerfLogger for logging timings
Modified:
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java
Modified:
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java?rev=1672835&r1=1672834&r2=1672835&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java
(original)
+++
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndex.java
Sat Apr 11 06:11:57 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);
}