Commit Graph

37124 Commits

Author SHA1 Message Date
Luca Cavanna 09da2291c5
Make IndexSearcher#getSlices final and clarify docs (#12718)
IndexSearcher exposes a public getSlices method, that is used to
retrieve the slices that the searcher executes queries against, as well
as slices, which is supposed to be overridden to customize the creation
of slices.

I believe that getSlices should be final: there is no reason to override
the method. Also, it is too easy to confuse the two and end up
overriding the wrong one by mistake.
2023-10-26 12:34:37 +02:00
gf2121 c701a5d9be
Disable suffix sharing for block tree index (#12722) 2023-10-26 12:34:48 +08:00
Dzung Bui 12fc7bf49f
Consolidate FSTStore and BytesStore in FST (#12709)
* Remove direct dependency of NodeHash to FST

* Fix index out of bounds when writing FST to different metaOut (#12697)

* Tidify code

* Update CHANGES.txt

* Re-add assertion

* Remove direct dependency of NodeHash to FST

* Hold off the FSTTraversal changes

* Rename variable

* Add Javadoc

* Add @Override

* tidy

* tidy

* Change to FSTReader

* Update CHANGES.txt
2023-10-25 18:26:27 -07:00
Simon Willnauer 01acb1c37b Close IndexWriter and Directory in try blocks Relates to #12685 2023-10-25 23:36:02 +02:00
Adrien Grand 5966ec6e79 Fix comment. 2023-10-25 20:26:01 +02:00
Adrien Grand 8db38f8713 Fix test failures. 2023-10-25 20:18:06 +02:00
Adrien Grand 3d4082ca3d 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-25 14:29:44 +02:00
gf2121 779592771a
Speed up the sort when building forward index (#12712) 2023-10-25 13:36:52 +08:00
gf2121 676dceb081
Use Arrays#mismatch for Outputs#common operations (#12710) 2023-10-25 10:25:10 +08:00
Luca Cavanna fbdc458f86 Address TestTaskExecutor issues
- Use a thread factory
- Remove unused imports
2023-10-24 20:51:45 +02:00
Luca Cavanna eefa0ab85e Add missing CHANGES entry for #12689 2023-10-24 20:43:17 +02:00
Luca Cavanna f6ca54523c Address TestTaskExecutor test failure
Turns out that testCancelTasksOnException require a single threaded
executor. Given that most tests in the class rely make more sense with a
single thread, I went back to 1 thread for the shared executor and used
a multi-threaded executor in the only test that relies on multiple
threads.
2023-10-24 20:40:58 +02:00
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