Commit Graph

36762 Commits

Author SHA1 Message Date
Benjamin Trent f2bf5339e5
Add new int8 scalar quantization to HNSW codec (#12582)
Adds new int8 scalar quantization for HNSW codec. This uses a new lucene9.9 format and auto quantizes floating point vectors into bytes on flush and merge.
2023-10-24 14:31:54 -04:00
Nelson Osacky e5b55761d0
Build: build scans on ge.apache.org to benefit from deep build insights (#12293)
Apache committers who opt-in (via authentication) can have their local build scans be submitted to ge.apache.org.

Co-authored-by: Clay Johnson <cjohnson@gradle.com>
2023-10-24 12:32:18 -04:00
Adrien Grand c95a8f6513 Move CHANGES to the right section. 2023-10-24 18:03:53 +02:00
Adrien Grand 611bbbd951
Sometimes intersect the essential clause and the best non-essential clause. (#12589)
The idea behind MAXSCORE is to run disjunctions as `+(essentialClause1 ...
essentialClauseM) nonEssentialClause1 ... nonEssentialClauseN`, moving more and
more clauses from the essential list to the non-essential list as the minimum
competitive score increases. For instance, a query such as `the book of life`
which I found in the Tantivy benchmark ends up running as `+book the of life`
after some time, ie. with one required clause and other clauses optional. This
is because matching `the`, `of` and `life` alone is not good enough for
yielding a match.

Here some statistics in that case:
 - min competitive score: 3.4781857
 - max_window_score(book): 2.8796153
 - max_window_score(life): 2.037863
 - max_window_score(the): 0.103848875
 - max_window_score(of): 0.19427927

Actually if you look at these statistics, we could do better, because a match
may only be competitive if it matches both `book` and `life`, so this query
could actually execute as `+book +life the of`, which may help evaluate fewer
documents compared to `+book the of life`. Especially if you enable recursive
graph bisection.

This is what this PR tries to achieve: in the event when there is a single
essential clause and matching all clauses but the best non-essential clause
cannot produce a competitive match, then the scorer will only evaluate
documents that match the intersection of the essential clause and the best
non-essential clause.

It's worth noting that this optimization would kick in very frequently on
2-clauses disjunctions.
2023-10-24 17:54:23 +02:00
Adrien Grand 5bca0aa391 Revert "Run merge-on-full-flush even though no changes got flushed. (#12549)"
This reverts commit 71c4ea74ba.
2023-10-24 17:43:57 +02:00
Luca Cavanna 1200ecce3a
TaskExecutor to cancel all tasks on exception (#12689)
When operations are parallelized, like query rewrite, or search, or
createWeight, one of the tasks may throw an exception. In that case we
wait for all tasks to be completed before re-throwing the exception that
were caught. Tasks that were not started when the exception is captured
though can be safely skipped. Ideally we would also cancel ongoing tasks
but I left that for another time.
2023-10-24 17:38:25 +02:00
Adrien Grand 71c4ea74ba
Run merge-on-full-flush even though no changes got flushed. (#12549)
Currently, merge-on-full-flush only checks if merges need to run if changes
have been flushed to disk. This prevents from having different merging logic
for refreshes and commits, since the merge policy would not be checked upon
commit if no new documents got indexed since the previous refresh.
2023-10-24 16:57:05 +02:00
Shubham Chaudhary 5461d1a160
Scorer should sum up scores into a double (#12682)
### Description

Addresses #12675 . Along with `MultiSimilarity.MultiSimScorer` found some others candidate scorer implementations for this fix.
2023-10-23 13:01:06 -04:00
Simon Willnauer 6677109ee6
Record if block API has been used in SegmentInfo (#12685)
If the add/updateDocuments(List<>) API is used, lucene guarantees that
all documents are indexed in the same segment with consecutive document IDs.
This enables features like nested documents etc. This change records the usage
of this API in SegmentsInfo and preserves this property across merges.

Relates to #12665
2023-10-23 09:46:12 +02:00
Uwe Schindler bbf197fdc2
MMapDirectory with MemorySegment: Confirm that scope/session is no longer alive before throwing AlreadyClosedException (#12707) 2023-10-22 19:14:29 +02:00
Uwe Schindler 9729123369
Improve handling of NullPointerException in MMapDirectory's IndexInputs (check the "closed" condition) (#12705) 2023-10-22 10:58:44 +02:00
Dzung Bui ad06ee57b8
Remove direct dependency of NodeHash to FST (#12690)
* Remove direct dependency of NodeHash to FST

* tidy
2023-10-21 08:26:07 -04:00
Shubham Chaudhary de8ae1de7c
Optimize computing number of levels in MultiLevelSkipListWriter#bufferSkip (#12653)
* Optimize computing number of levels in MultiLevelSkipListWriter#bufferSkip

* CHANGES.txt entry
2023-10-21 07:52:28 -04:00
Rob Muir 90f8bac9f7 slight correction 2023-10-21 02:05:34 -04:00
Rob Muir c09fb560f7 add hsdis instructions for the macos 2023-10-21 02:02:24 -04:00
Michael McCandless afb2a60751
Bound the RAM used by the NodeHash (sharing common suffixes) during FST compilation (#12633)
* tweak comments; change if to switch

* remove old SOPs, minor comment styling, fixed silly performance bug on rehash using the wrong bitsRequired (count vs node)

* first raw cut; some nocommits added; some tests fail

* tests pass!

* fix silly fallback hash bug

* remove SOPs; add some temporary debugging metrics

* add temporary tool to test FST performance across differing NodeHash sizes

* remove (now deleted) shouldShareNonSingletonNodes call from Lucene90BlockTreeTermsWriter

* add simple tool to render results table to GitHub MD

* add simple temporary tool to iterate all terms from a provided luceneutil wikipedia index and build an FST from them

* first cut at using packed ints for hash t able again

* add some nocommits; tweak test_all_sizes.py to new RAM usage approach; when half of the double barrel is full, allocate new primary hash at full size to save cost of continuously rehashing for a large FST

* switch to limit suffix hash by RAM usage not count (more intuitive for users); clean up some stale nocommits

* switch to more intuitive approximate RAM (mb) limit for allowed size of NodeHash

* nuke a few nocommits; a few more remain

* remove DO_PRINT_HASH_RAM

* no more FST pruning

* remove final nocommit: randomly change allowed NodeHash suffix RAM size in TestFSTs.testRealTerms

* remove SOP

* tidy

* delete temp utility tools

* remove dead (FST pruning) code

* add CHANGES entry; fix one missed fst.addNode -> fstCompiler.addNode during merge conflict resolution

* remove a mal-formed nocommit

* fold PR feedback

* fold feedback

* add gradle help test details on how to specify heap size for the test JVM; fix bogus assert (uncovered by Test2BFST); add TODO to Test2BFST anticipating building massive FSTs in small bounded RAM

* suppress sysout checks for Test2BFSTs; add helpful comment showing how to run it directly

* tidy
2023-10-20 11:52:55 -04:00
Dzung Bui 0d8a3e6c4f
Fix index out of bounds when writing FST to different metaOut (#12697) (#12698)
* Fix index out of bounds when writing FST to different metaOut (#12697)

* Tidify code

* Update CHANGES.txt

* Re-add assertion
2023-10-20 07:25:04 -04:00
gf2121 343a9e7100
Avoid object construction when linear searching arcs (#12692) 2023-10-20 00:41:09 +08:00
Stéphane Campinas 6fde1db228
chore: update the Javadoc example in Analyzer (#12693)
Close #12666
2023-10-18 10:19:19 -04:00
iverase 723c05b047 coorect position on entry in CHANGES.txt 2023-10-18 08:14:56 +02:00
Ignacio Vera 17ea6d5a0d
Refactor ByteBlockPool so it is just a "shift/mask big array" (#12625)
Moved all the hairy allocSlice stuff as static method in TermsHashPerField and I introduce a BytesRefBlockPool to
 encapsulate of the BytesRefHash write/read logic.
2023-10-18 08:10:48 +02:00
Benjamin Trent ea272d0eda
Extract the hnsw graph merging from being part of the vector writer (#12657)
While working on the quantization codec & thinking about how merging will evolve, it became clearer that having merging attached directly to the vector writer is weird.

I extracted it out to its own class and removed the "initializedNodes" logic from the base class builder.

Also, there was on other refactoring around grabbing sorted nodes from the neighbor iterator, I just moved that static method so its not attached to the writer (as all bwc writers need it and all future HNSW writers will as well).
2023-10-17 13:45:25 -04:00
Adrien Grand 218eddec70
Specialize `BlockImpactsDocsEnum#nextDoc()`. (#12670)
When we initially introduced support for dynamic pruning, we had an
implementation of WAND that would almost exclusively use `advance()`. Now that
we switched to MAXSCORE and rely much more on `nextDoc()`, it makes sense to
specialize nextDoc() as well.
2023-10-17 14:13:40 +02:00
Adrien Grand f055ac6e16
Speed up TestIndexOrDocValuesQuery. (#12672)
This changes the following:
 - fewer docs indexed in non-nightly runs,
 - `QueryUtils#checkFirstSkipTo` uses the `ScorerSupplier` API to convey it
   will only check one doc,
 - `QueryUtils#checkFirstSkipTo` no longer relies on timing to run in a
   reasonably amount of time.
2023-10-17 14:13:21 +02:00
gf2121 8961dda2a4
Remove over-counting of deleted terms (#12586) 2023-10-17 19:13:24 +08:00
gf2121 da032535d6
Use MergeSorter in StableStringSorter (#12652) 2023-10-17 17:52:16 +08:00
gf2121 c6e76d3e01
Use radix sort to speed up the sorting of terms in TermInSetQuery (#12587) 2023-10-17 17:31:29 +08:00
Dawid Weiss 6dac2f7afc
Add timeouts to github jobs. Estimates taken from empirical run times (actions history), with a generous buffer added. (#12687) 2023-10-17 08:02:53 +02:00
Patrick Zhai a1cf22e6a9
Optimize OnHeapHnswGraph's data structure (#12651)
make the internal graph representation a 2d array
2023-10-16 13:13:37 -07:00
Dawid Weiss 2482f7688b
Add createClassLoader to replicator permissions (block specific to jacoco). (#12684) 2023-10-16 09:11:57 +02:00
Uwe Schindler f64bb19697 Move changes entry before backporting 2023-10-15 19:36:39 +02:00
Robert Muir 2b105f732e
CHANGES 2023-10-15 08:43:50 -04:00
Uwe Schindler c8852a012f Move testing properties to provider class (no classloading deadlock possible) and fallback to default provider in non-test mode 2023-10-15 14:33:43 +02:00
Robert Muir 650a47e707
Merge branch 'main' into vector_512: stomping over any possible conflicting changes: if you made any, i erased them. git is garbage. 2023-10-15 08:20:43 -04:00
Robert Muir db746bdbc3
simple cleanups to vector code (#12680)
* simple cleanups to vector code

* cleanup cosine too, no perf impact
2023-10-15 08:12:14 -04:00
Uwe Schindler dbda33fb2f
Better detect vector module in non-default setups (e.g., custom module layers) (#12677) 2023-10-15 12:45:52 +02:00
Robert Muir a69cdeff56
fix html 2023-10-14 19:56:42 -04:00
Robert Muir 90c01c1e80
tidy 2023-10-14 19:54:47 -04:00
Robert Muir 94619e00e0
fix Panama provider to only have static final constants, but allow sysprops for testing.
Set those sysprops by the build when running tests: force integer vectors on always, and randomize vector size
2023-10-14 19:51:59 -04:00
Robert Muir cce3cf106a
stop using SPECIES_PREFERRED except at the top of this file 2023-10-14 18:08:33 -04:00
Robert Muir 3ec9c26d67
speedup all binary functions on avx256, speedup binary square on avx512 2023-10-14 16:28:26 -04:00
Robert Muir e93bd524cf
cleanup cosine too, no perf impact 2023-10-14 14:10:32 -04:00
Patrick Zhai bac4dd28e0
Fix unstable test TestVectorSimilarityValuesSource (#12678) 2023-10-14 11:04:29 -07:00
Robert Muir a72bf7ce68
simple cleanups to vector code 2023-10-14 13:08:36 -04:00
Robert Muir 872aee6d18
Speedup integer functions for 128-bit neon vectors (#12632) 2023-10-14 11:38:33 -04:00
Robert Muir a4ff129de8
migrate all vectorbench methods to lucene (#12667)
* migrate all vectorbench methods to lucene

Co-authored-by: Uwe Schindler <uschindler@apache.org>
2023-10-14 11:36:42 -04:00
Uwe Schindler 2b8c4b0781
Improve logging for vector support (#12676) 2023-10-13 22:04:05 +02:00
Adrien Grand fb674aa7f2
Fix TestSizeBoundedForceMerge. (#12673)
This test sometimes fails because `SimpleText` has a non-deterministic size for
its segment info file, due to escape characters. The test now enforces the
default codec, and checks that segments have the expected size before moving
forward with forcemerge().

Closes #12648
2023-10-13 18:05:27 +02:00
Greg Miller 7b7b0d2119
Ensure LeafCollector#finish is only called once on the main collector during drill-sideways (#12642) 2023-10-13 07:24:40 -07:00
Greg Miller 681975d6e8
Add javadoc note to LeafCollector#finish (#12643) 2023-10-13 07:03:24 -07:00