Skip to content

Commit 1aeaee6

Browse files
committed
Reuse TantivySearcher across queries via searcher pool
1 parent 14faa78 commit 1aeaee6

2 files changed

Lines changed: 0 additions & 415 deletions

File tree

paimon-tantivy/paimon-tantivy-index/src/main/java/org/apache/paimon/tantivy/index/TantivyFullTextGlobalIndexReader.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ public class TantivyFullTextGlobalIndexReader implements GlobalIndexReader {
6060

6161
private volatile TantivySearcherPool.PooledEntry borrowed;
6262

63-
private long lastOpenNanos;
64-
private long lastSearchNanos;
65-
6663
public TantivyFullTextGlobalIndexReader(
6764
GlobalIndexFileReader fileReader,
6865
List<GlobalIndexIOMeta> ioMetas,
@@ -80,26 +77,14 @@ public TantivyFullTextGlobalIndexReader(
8077
public Optional<ScoredGlobalIndexResult> visitFullTextSearch(FullTextSearch fullTextSearch) {
8178
try {
8279
ensureLoaded();
83-
long searchStart = System.nanoTime();
8480
SearchResult result =
8581
borrowed.searcher.search(fullTextSearch.queryText(), fullTextSearch.limit());
86-
lastSearchNanos = System.nanoTime() - searchStart;
8782
return Optional.of(toScoredResult(result));
8883
} catch (IOException e) {
8984
throw new RuntimeException("Failed to search Tantivy full-text index", e);
9085
}
9186
}
9287

93-
/** Nanos spent loading the index on the most recent pool miss (0 if pool hit). */
94-
public long getLastOpenNanos() {
95-
return lastOpenNanos;
96-
}
97-
98-
/** Nanos spent in the last {@code searcher.search()} call. */
99-
public long getLastSearchNanos() {
100-
return lastSearchNanos;
101-
}
102-
10388
private ScoredGlobalIndexResult toScoredResult(SearchResult result) {
10489
RoaringNavigableMap64 bitmap = new RoaringNavigableMap64();
10590
HashMap<Long, Float> id2scores = new HashMap<>(result.size());
@@ -128,7 +113,6 @@ private void ensureLoaded() throws IOException {
128113
private TantivySearcherPool.PooledEntry createEntry() throws IOException {
129114
SeekableInputStream in = fileReader.getInputStream(ioMeta);
130115
try {
131-
long openStart = System.nanoTime();
132116
ArchiveLayout layout = layoutCache.get(poolKey);
133117
if (layout == null) {
134118
layout = parseArchiveHeader(in);
@@ -138,7 +122,6 @@ private TantivySearcherPool.PooledEntry createEntry() throws IOException {
138122
TantivySearcher searcher =
139123
new TantivySearcher(
140124
layout.fileNames, layout.fileOffsets, layout.fileLengths, streamInput);
141-
lastOpenNanos = System.nanoTime() - openStart;
142125
return new TantivySearcherPool.PooledEntry(searcher, in);
143126
} catch (Exception e) {
144127
in.close();

0 commit comments

Comments
 (0)