Commit Graph

37769 Commits

Author SHA1 Message Date
Dawid Weiss b9385a8a29
Add github on-commit tests on MacOS and Windows (#14054) 2024-12-10 20:19:28 +01:00
Dawid Weiss 76f5254a75
IndexInput.isLoaded seems to return false for mmap index inputs on Windows #14050 (#14053) 2024-12-10 19:26:18 +01:00
Adrien Grand a62e716f21 Revert "Refactor dummy scorables. (#14046)"
This reverts commit a833887be6.
2024-12-10 16:12:05 +01:00
Michael Sokolov 4f8035c013 Disable KNN format randomization in some KNN block join tests 2024-12-09 12:14:38 -05:00
Michael Sokolov 6b0112cdee
Randomize KnnVector codec params in RandomCodec; addresses gh-14047 (#14049) 2024-12-09 11:22:43 -05:00
Adrien Grand a833887be6
Refactor dummy scorables. (#14046)
This makes our scores that produce dummy scorables share the same implementation.
2024-12-09 15:39:55 +01:00
Adrien Grand e34e0824fd
Reduce specialization in `ForUtil` and `ForDeltaUtil`. (#14048)
These classes specialize all bits per value up to 24. But performance of high
numbers of bits per value is not very important, because they are used by short
postings lists, which are fast to iterate anyway. So this PR only specializes
up to 16 bits per value.

For instance, if a postings list uses blocks of 17 bits per value, it means
that one can find gaps of 65,536 consecutive doc IDs that do not contain the
term. Such rare terms do not drive query performance.
2024-12-07 11:50:29 +01:00
Adrien Grand deae39b01d Fix test failures. 2024-12-06 14:31:33 +01:00
Benjamin Trent f42f03a191
adding changes for PR #13819 (#14044) 2024-12-06 07:03:20 -05:00
Adrien Grand c88f9334e5
Introduce a BulkScorer for DisjunctionMaxQuery. (#14040)
This introduces a bulk scorer for `DisjunctionMaxQuery` that delegates to the
bulk scorers of the query clauses. This helps make the performance of top-level
`DisjunctionMaxQuery` better, especially when its clauses have optimized bulk
scorers themselves (e.g. disjunctions).
2024-12-06 11:01:01 +01:00
Adrien Grand 8103f2a44a
Remove unused +1 on doc buffer length. (#14043)
We no longer take advantatge of it.
2024-12-06 10:43:11 +01:00
Adrien Grand ef2e2548db
Track the number of docs left to decode instead of the number of docs decoded. (#14045)
`docCountUpto` tracks the number of documents decoded so far, but it's only
used to compute the number of docs left to decode. So let's track the number of
docs left to decode instead.
2024-12-06 10:42:39 +01:00
Robert Muir c1362cc6a3
Revert "Ensure Panama float vector distance impls inlinable (#14031)" (#14041)
This reverts commit 4f08f3dc6f.
2024-12-04 15:50:18 -05:00
Adrien Grand 6c48b404cd
Combine all postings enum impls of the default codec into a single class (#14033)
Recent speedups by making call sites bimorphic made me want to play with combining all postings enums and impacts enums of the default codec into a single class, in order to reduce polymorphism. Unfortunately, it does not yield a speedup since the major polymorphic call sites we have that hurt performance (DefaultBulkScorer, ConjunctionDISI) are still 3-polymorphic or more.

Yet, reduced polymorphism at little performance impact is a good trade-off as it would help make call sites bimorphic for users who don't have as much query diversity as nightly benchmarks, or in the future when we remove other causes of polymorphism.
2024-12-04 15:19:41 +01:00
Adrien Grand 3fcadaf8f5
Reduce specialization in TopScoreDocCollector. (#14038)
The specialization of `SimpleCollector` vs. `PagingCollector` only helps save a
null check, so it's probably not worth the complexity. Benchmarks cannot see a
difference with this change.
2024-12-04 15:12:26 +01:00
Adrien Grand b758602273
Improve search equivalence tests. (#14036)
This addresses an existing TODO about giving terms a zipfian distribution, and
disables query caching to make sure that two-phase iterators are properly
tested.
2024-12-04 15:12:04 +01:00
Jim Ferenczi 8fdd48b3b3
Add support for storing term vectors in FeatureField (#14034)
This update introduces an option to store term vectors generated by the FeatureField.
With this option, term vectors can be used to access all features for each document.
2024-12-04 12:31:00 +00:00
Michael Froh 552b3f52d7
Simplify logic in ScoreCachingWrappingScorer (#14012)
This is functionally equivalent to the logic that was present, but
makes the behavior clearer.
2024-12-03 19:24:41 +01:00
Viliam Durina 9c86bed848
Grammar and typo fixes (#14019) 2024-12-03 11:51:53 -05:00
Adrien Grand df7b1f618d
LUCENE-10073: Reduce merging overhead of NRT by using a greater mergeFactor on tiny segments. (#266)
Closes #11111
2024-12-03 17:47:36 +01:00
Chris Hegarty 4f08f3dc6f
Ensure Panama float vector distance impls inlinable (#14031)
This commit reduces the Panama vector distance float implementations to less than the maximum bytecode size of a hot method to be inlined (325).

E.g. Previously:  org.apache.lucene.internal.vectorization.PanamaVectorUtilSupport::dotProductBody (355 bytes)   failed to inline: callee is too large.

After: org.apache.lucene.internal.vectorization.PanamaVectorUtilSupport::dotProductBody (3xx bytes)   inline (hot)

This helps things a little.

Co-authored-by: Robert Muir <rmuir@apache.org>
2024-12-03 10:49:33 +00:00
Adrien Grand b2a10e3643
Speed up PostingsEnum when reading positions. (#14032)
This PR changes the following:
 - As much work as possible is moved from `nextDoc()`/`advance()` to
   `nextPosition()`. This helps only pay the overhead of reading positions when
   all query terms agree on a candidate.
 - Frequencies are read lazily. Again, this helps in case a document is needed
   in a block, but clauses do not agree on a common candidate match, so
   frequencies are never decoded.
 - A few other minor optimizations.
2024-12-02 23:26:04 +01:00
Luca Cavanna 067b472a32 adjust changelog for #14027 2024-12-02 10:33:17 +01:00
Luca Cavanna a6f9bded85
Make SegmentInfos#readCommit(Directory, String, int) public (#14027)
The corresponding readLatestCommit method is public and can be used to
read segment infos from indices that are older than N - 1.
The same should be possible for readCommit, but that requires the method
that takes the minimum supported version as an argument to be public.
2024-12-02 10:24:56 +01:00
zhouhui a2483062d6
Use Arrays.mismatch in FSTCompiler#add. (#13924) 2024-12-01 12:07:08 -05:00
Viliam Durina be66af249f
Fix changelog for GITHUB#14011 (#14018)
* Fix changelog for GITHUB#14011
2024-12-01 11:41:10 -05:00
Adrien Grand 06a320a53e Rewrite queries with no SHOULD clauses and minimumShouldMatch > 0 to a MatchNoDocsQuery.
Closes #14026
2024-11-29 14:47:44 +01:00
Adrien Grand f9869b54d5
Make inlining decisions a bit more predictable in our main queries. (#14023)
This implements a small contained hack to make sure that our compound scorers
like `MaxScoreBulkScorer`, `ConjunctionBulkScorer`,
`BlockMaxConjunctionBulkScorer`, `WANDScorer` and `ConjunctionDISI` only have
two concrete implementations of `DocIdSetIterator` and `Scorable` to deal with.

This helps because it makes calls to `DocIdSetIterator#nextDoc()`,
`DocIdSetIterator#advance(int)` and `Scorable#score()` bimorphic at most, and
bimorphic calls are candidate for inlining.

This should help speed up boolean queries of term queries at the expense of
boolean queries of other query types. This feels fair to me as it gives more
speedups than slowdowns in benchmarks, and that boolean queries of term queries
are extremely typical. Boolean queries that mix term queries and other types of
queries may get a slowdown or a speedup depending on whether they get more from
the speedup on their term clauses than they lose on their other clauses.
2024-11-29 13:27:49 +01:00
ChrisHegarty 70530a92d9 add missing changes log entry for 13998 2024-11-29 10:32:45 +00:00
Chris Hegarty 7dbbd0daa9
Add IndexInput isLoaded (#13998)
This commit adds IndexInput::isLoaded to help determine if the contents of an input is resident in physical memory.

The intent of this new method is to help build inspection and diagnostic infrastructure on top.
2024-11-29 10:28:32 +00:00
Adrien Grand 98c59a710e
Run filtered disjunctions with MaxScoreBulkScorer. (#14014)
Running filtered disjunctions with a specialized bulk scorer seems to yield a
good speedup. For what it's worth, I also tried to implement a MAXSCORE-based
scorer to see if it had to do with the `BulkScorer` specialization or the
algorithm, but it didn't help.

To work properly, I had to add a rewrite rule to inline disjunctions in a MUST
clause.

As a next step, it would be interesting to see if we can further optimize this
by loading the filter into a bitset and applying it like live docs.
2024-11-27 21:56:03 +01:00
Adrien Grand d9aa525c9e
Make WANDScorer compute scores on the fly. (#14021)
Currently, `WANDSCorer` considers that a hit is a match if the sum of maximum
scores across clauses is more than or equal to the minimum competitive score.
We can do better by computing scores of leading clauses on the fly. This helps
because scores are often lower than the score upper bound, so using actual
scores instead of score upper bounds can help skip advancing more clauses.

For reference, we are already doing the same trick in our conjunction (bulk)
scorers and in `MaxScoreBulkScorer` (bulk scorer for top-level disjunctions).
2024-11-26 16:00:30 +01:00
Jean-François BOEUF 534f815927
Improve checksum calculations (#13989)
Take advantage of the existing buffer in BufferedChecksum to speed up
reads for Longs, Ints, Shorts and Long arrays by avoiding byte-by-byte
reads.
2024-11-25 15:59:15 +01:00
Adrien Grand a5bf8a58b3
Stop using `SlowImpactsEnum` for terms whose `docFreq` is less than 128. (#14017)
We currently use `SlowImpactsEnum` for terms whose `docFreq` is less than 128
because it's convenient as these terms don't have impacts anyway. But a recent
slowdown on nightly benchmarks suggests that this contributes to making some
hot calls more polymorphic than we'd like, so this PR moves such terms back to
the regular impacts enums.
2024-11-25 15:48:27 +01:00
Stefan Vodita d19b8425dd Fix changelog for GITHUB#14008 2024-11-23 12:43:34 +00:00
Paul King adc1789b3b
Taxonomy counts are incorrect due to ordinal sorting (#14008) (#14010) 2024-11-23 12:03:23 +00:00
Sascha Szott ad2773b4ef
fix JavaDoc: TopDocs instead of Hits (#14015) 2024-11-22 15:56:58 -08:00
Adrien Grand de1feea401
Make CombinedFieldQuery eligible for WAND/MAXSCORE. (#13999)
`CombinedFieldQuery` currently returns an infinite maximum score. We can do
better by returning the maximum score that the sim scorer can return, which in
the case of BM25 is bounded by the IDF. This makes CombinedFieldQuery eligible
for WAND/MAXSCORE (not their block-max variants though, since we return the
same score upper bound for the whole index).
2024-11-22 18:18:51 +01:00
Adrien Grand 90fee7e13f
Only consider clauses whose cost is less than the lead cost to compute block boundaries in WANDScorer. (#14003)
WANDScorer implements block-max WAND and needs to recompute score upper bounds
whenever it moves to a different block. Thus it's important for these blocks to
be large enough to avoid re-computing score upper bounds over and over again.
With this commit, WANDScorer no longer uses clauses whose cost is higher than
the cost of the filter to compute block boundaries. This effectively makes
blocks larger when the filter is more selective.
2024-11-22 18:18:00 +01:00
Viliam Durina 532d267228
Reduce allocation rate in HNSW concurrent merge (#14011)
The PR removes the allocation of a new `LockedRow` for each locking operation in `HnswLock`. Even though the object was very quickly released, and JIT supports on-stack allocation, it didn't happen in my experiments on OpenJDK 21 - it's easy to avoid the allocation, rather than rely on the JIT.
2024-11-22 11:48:50 -05:00
Tejas Shah 46204f6b53
Introduces IndexInput#updateReadAdvice to change the ReadAdvice while merging vectors (#13985)
The commit updates the ReadAdvice.SEQUENTIAL before the merge starts and reverts it to ReadAdvice.RANDOM at the end of the merge for Lucene99FlatVectorsReader.
2024-11-22 12:14:49 +00:00
Paul King 5eeb760dae
Update ComplexPhraseQueryParser.java (#14005)
Fix typo
2024-11-21 09:13:23 +03:00
Adrien Grand 9b5edabf21 Revert "Only consider clauses whose cost is less than the lead cost to compute block boundaries in WANDScorer. (#14000)"
This reverts commit 5807ff1620.
2024-11-20 10:15:44 +01:00
Adrien Grand 4aeecdfebf
Speed up top-k retrieval of filtered disjunctions a bit. (#13996)
This moves work from `advance(int target)` to `TwoPhaseIterator#matches()` so
that we do less work on hits that do not match the filter.
2024-11-19 09:53:45 +01:00
Adrien Grand 5807ff1620
Only consider clauses whose cost is less than the lead cost to compute block boundaries in WANDScorer. (#14000)
WANDScorer implements block-max WAND and needs to recompute score upper bounds
whenever it moves to a different block. Thus it's important for these blocks to
be large enough to avoid re-computing score upper bounds over and over again.
With this commit, WANDScorer no longer uses clauses whose cost is higher than
the cost of the filter to compute block boundaries. This effectively makes
blocks larger when the filter is more selective.
2024-11-19 09:27:13 +01:00
Viswanath Kuchibhotla a991a9a861
Adding filter to the toString() method of KnnFloatVectorQuery (#13990)
* Adding filter to toString() of KnnFloatVectorQuery when it's present (addresses https://github.com/apache/lucene/issues/13983)

* addressing review comments

* adding knnbytevectorquery

* unit test improvements

* tidy

* adding changes entry for the bug fix
2024-11-18 14:44:26 -05:00
Adrien Grand 4400d55297
Speed up top-k retrieval on filtered conjunctions. (#13994)
A while back we added an optimized bulk scorer that implements block-max AND,
this yielded a good speedup on nightly benchmarks, see annotation `FP` at
https://benchmarks.mikemccandless.com/AndHighHigh.html. With this PR, filtered
conjunctions now also run through this optimized bulk scorer by doing two
things:
 - It flattens inner conjunctions. This makes queries initially written as
   something like `+(+term1 +term2) #filter` rewritten to
   `+term1 +term2 #filter`.
 - It evaluates queries that have a mix of MUST and FILTER clauses evaluated
   through `BlockMaxConjunctionBulkScorer` by treating FILTER clauses as
   scoring clauses that produce a score of 0.
2024-11-18 08:51:35 +01:00
Viswanath Kuchibhotla a0e1eeefeb
Suppressing "automatic module" warning for benchmark-jmh (#13997)
via Viswanath Kuchibhotla
2024-11-17 07:41:27 -05:00
Lu Xugang 300862bd20
Remove duplicate test code (#13982)
The only diff between doIterate1  and doIterate2  is bb < b.length() in doIterate1 , but this condition is always true, so we should remove it
2024-11-16 02:09:41 +08:00
Chris Hegarty 8698dd85d8
Allow easier verification of the Panama Vectorization provider with newer Java versions (#13986)
This commit allows easier verification of the Panama Vectorization provider with newer Java versions.

The upper bound Java version of the Vectorization provider is hardcoded to the version that has been tested and is known to work. This is a bit inflexible when experimenting with and verifying newer JDK versions. This change proposes to add a new system property that allows to set the upper bound of the range of Java versions supported.

With this change, and the accompanying small gradle change, then one can verify newer JDKs as follows:

CI=true; RUNTIME_JAVA_HOME=/Users/chegar/binaries/jdk-24.jdk-ea-b23/Contents/Home
./gradlew :lucene:core:test -Dorg.apache.lucene.vectorization.upperJavaFeatureVersion=24

This change helps both testing and verifying with Early Access JDK builds, as well as allowing to override the upper bound when the JDK is known to work fine.
2024-11-14 09:02:15 +00:00