Commit Graph

37346 Commits

Author SHA1 Message Date
Adrien Grand a2676b1b26
Use ReadAdvice.RANDOM by default. (#13244)
This switches the default `ReadAdvice` from `NORMAL` to `RANDOM`, which is a better fit for the kind of access pattern that Lucene has. This is expected to reduce page cache trashing and contention on the page table.

`NORMAL` is still available, but never used by any of the file formats.
2024-04-04 16:45:41 +02:00
Robert Muir 54a2e11434
upgrade icu4j to 74.2 (#13239)
* fix regeneration, upgrade icu jar, fully regenerate sources, tests pass
* Upgrade RBBI grammar to match 74.2 (add instructions on how to do this)
* Make use of Script_Extensions property in tokenization
* document and test nfkc_scf form
* update tokenizer for improved text in UAX#24 5.2
* use indic syllablic category for myanmar tokenizer instead of relying on Gc
2024-04-04 08:35:25 -04:00
Michael Sokolov 342c814caf
BaseVectorSimilarityQueryTestCase assumes connected hnsw graph (#13260) 2024-04-04 08:31:02 -04:00
Kaival Parikh df154cdc22
Add timeout support to AbstractKnnVectorQuery (#13202)
* Add timeout support to graph searches in AbstractKnnVectorQuery

* Also timeout exact searches

* Return partial KNN results

* Add tests for partial KNN results

- Refactor tests to base classes
- Also timeout exact searches in Lucene99HnswVectorsReader

* Add CHANGES.txt entry and fix some comments

---------

Co-authored-by: Kaival Parikh <kaivalp2000@gmail.com>
2024-04-03 06:53:24 -07:00
Benjamin Trent 45c4f8c052
Adds bwc indices for 9.10.1 (#13258) 2024-04-03 07:42:24 -04:00
Zhang Chao 9c9f934a7c
Simplify PackedInts#longCount (#13256) 2024-04-03 16:46:53 +08:00
Benjamin Trent 07d3be59af
Expand scalar quantization with adding half-byte (int4) quantization (#13197)
This PR is a culmination of some various streams of work:

 - Confidence interval optimizations, unlocked even smaller quantization bytes.
 - The ability to quantize down smaller than just int8 or int7
 - Adding an optimized int4 (halfbyte) vector API comparison for dot-product.

The idea of further scalar quantization gives users the choice between:

 - Further quantizing to gain space through compressing the bits into single byte values
 - Or allowing quantization to give guarantees around maximal values that afford faster vector operations.

I didn't add more panama vector APIs as I think trying to micro-optimize int4 for anything other than dot-product was a fools errand. Additionally, I only focused on ARM. I experimented with trying to get better performance on other architectures, but didn't get very far, so I fall back to dotProduct.
2024-04-02 13:38:40 -04:00
Mike McCandless bf193a7125 #13149: move CHANGES entry under 9.11.0 2024-04-02 09:59:34 -04:00
Anton Hägerstrand 4eeb3a792d
Made DocIdsWriter use DISI when reading documents with an IntersectVisitor (#13149)
* Made DocIdsWriter use DISI when reading documents with an IntersectVisitor.

Instead of calling IntersectVisitor.visit for each doc in the
readDelta16 and readInts32 methods, create a DocIdSetIterator
and call IntersectVisitor.visit(DocIdSetIterator) instead.

This seems to make Lucene faster at sorting and range querying
tasks - the hypothesis being that it is due to fewer virtual calls.

* Spotless

* Changed bulk iteration to use IntsRef instead.

* Clearer comment.

* Decrease cost outside loop

* Added test to make inverse intsref be used.

* Wording improvement in javadoc.

* Added CHANGES.txt entry.
2024-04-02 09:44:31 -04:00
cinsttool 7c3ee797a9
Fix container inefficiencies in FieldInfos.java (#13254) 2024-04-02 14:12:17 +02:00
Mike McCandless baecaf556f Fix PR number reference (#11722 -> #11888) 2024-04-01 09:52:10 -04:00
Mike McCandless 7eec0a4847 #11722: add CHANGES.txt entry 2024-04-01 09:46:24 -04:00
zhouhui bf074502df
[Fix] Binary search the BlockTree term entries when all suffixes have the same length in a leaf block. (#11888)
* Binary search the entries when all suffixes have the same length in a leaf block.

* add comment on allEqual.

* BackwardsCompatibility: keep the same logic on fillTerm and SeekStatus(NOT_FOUND, END).

* Update comments: modify scan to binary search.

* Add unit test for binarySearchTermLeaf.

* Format code.

* Assert the value of termsEnum.term() is correct after seeking.

* Add CHANGES entry.

* Clarify "leaf block _of the terms dict_"

* Set suffixesReader's position.

* Advance to the greater term If binary search ended at the less term.

* Assert termsEnum's position after seeking.

* Tidy.

* Advance to the greater term if binary search ended at the less term: nextEnt plus 1.

* Advance to the greater term if binary search ended at the less term and greater term exists.

* Add test case: target greater than the last entry of the matched block.

* Move test case that target greater than the last entry of the matched block to TestLucene90PostingsFormat.

* Move test case for target greater than the last entry of the matched block to TestLucene99PostingsFormat

* Clarify code.

* Replace ternary with verbose if.

* Replace seekExact with seekCeil.

* Replace division by 2 with logical right shift.

* Remove assert ste.termExists.

* Clarify code.

* Remove stale change entry.

* Fix comment.

---------

Co-authored-by: Adrien Grand <jpountz@gmail.com>
2024-04-01 09:14:14 -04:00
Armin Braun 42f2da5fe2
Fix ram estimate and its test for PackedInts.NullReader singleton (#13250)
Correct estimate for singleton to return `0` and use custom accumulator in tests to
fix assertions. Tried not doing this in #13232 but turns out we need a little complexity here
since the singleton is recognized by the `RamUsageTester` in so far that is only counted
once if it shows up repeatedly in an array or so.

fixes #13249
2024-04-01 07:56:38 -04:00
Robert Muir e2110e0b8e
Add regeneration workaround to the docs 2024-03-30 09:52:21 -04:00
Benjamin Trent c0d81932df
Fix vector type check for diversified knn search (#13235)
I repeatably saw some test failures related to `TestParentBlockJoin[Byte|Float]KnnVectorQuery#testVectorEncodingMismatch`. This commit fixes those test failures and actually checks the field type.
2024-03-29 13:49:58 -04:00
Benjamin Trent 6d120c49a4
Add missing 9.10.1 in the Version file (#13248) 2024-03-29 11:52:01 -04:00
Kaival Parikh d6eb126871
Delete TimeLimitingCollector after deprecation (#13243)
Co-authored-by: Kaival Parikh <kaivalp2000@gmail.com>
2024-03-29 15:38:44 +01:00
Uwe Schindler ce978d7646
Cleanup Javadocs of IOContext and use simpler ctor for DEFAULT (#13247) 2024-03-29 15:08:16 +01:00
Uwe Schindler 11eb0cc317
Optimization: Use precalculated IOContexts for withReadAdvice() to not create new instances all the time (#13245) 2024-03-29 14:21:11 +01:00
Benjamin Trent 69172b14ce
Use FieldInfo vector similarity in knn readers (#13237)
Both the KnnWriters & FieldInfo keep track of the vector similarity used by a given field. This commit ensures they are the same and utilizes the FieldInfo one (which, while these are enums, are exactly the same).
2024-03-29 09:10:39 -04:00
Armin Braun c41eb227ea
Introduce singleton for PackedInts.NullReader of size 256 (#13232)
Size 256 is very common here throguh the monotonic long values default
page size. In ES we're seing many MB O(10M) of duplicate instances of this
size relatively quickly.
=> adding a singleton for it to save some heap
2024-03-29 13:54:04 +01:00
Adrien Grand 32d692049f
Replace (IO)Context#READ with (IO)Context.DEFAULT. (#13242)
`DEFAULT` doesn't mean much today and could be used whenever `READ` is used. So
let's use `DEFAULT` all the time instead and remove `READ`.
2024-03-29 10:37:26 +01:00
Adrien Grand 4a3f4cfe97
Make `OneMerge#reorder` preserve blocks. (#13128)
This updates `IndexWriter` to only call `OneMerge#reorder` when it has a chance
to preserve the block structure, ie. either there are no blocks or blocks are
identified by a parent field.

Furthermore, `MockRandomMergePolicy` is updated to preserve the block structure
when a parent field is configured.
2024-03-29 10:07:22 +01:00
Adrien Grand a807772d41
More consistently use a SEQUENTIAL ReadAdvice for merging. (#13229)
Merging `IOContext`s use a `SEQUENTIAL` `ReadAdvice`. However, some file
formats hardcode `IOContext.LOAD` for some of their files, which silences the
whole merging context, in particular the `SEQUENTIAL` `ReadAdvice`.

This PR switches file formats to
`ioContext.withReadAdvice(ReadAdvice.RANDOM_PRELOAD)` so that merges will use a
`SEQUENTIAL` `ReadAdvice` while searches will use a `RANDOM_PRELOAD`
`ReadAdvice`.

This is not a huge deal for `RANDOM_PRELOAD`, which is only used for very small
files. However, this change becomes more relevant for the new `RANDOM`
`ReadAdvice` as we would like merges to keep using a `SEQUENTIAL` `ReadAdvice`.
2024-03-29 09:14:14 +01:00
Kaival Parikh 878d233bc1
Mark TimeLimitingCollector as deprecated (#13220)
Co-authored-by: Kaival Parikh <kaivalp2000@gmail.com>
2024-03-29 09:12:48 +01:00
Tommaso Teofili 42a5ff6ace
Test KNN query works seamlessly regardless of underlying format (#13225)
* Test Knn query on different vector formats
2024-03-29 08:28:33 +01:00
Armin Braun 6cba773318
Use singleton for all-zeros DirectMonotonicReader.Meta (#13224)
Having a single block of all zeros is a fairly common case that is using
a lot of heap for duplicate instances in some use-cases in ES.
=> read a singleton for it to save the duplication
2024-03-29 07:23:00 +01:00
Robert Muir 8f4e449669
Add RomanianNormalizationFilter (#13233) 2024-03-28 18:35:39 -04:00
Robert Muir a7e916223c
remove unnecessary chmod+x, file is marked executable in snowball git 2024-03-28 16:43:47 -04:00
Robert Muir 3553769463
remove now-unnecessary snowball mojibake hack (#13231) 2024-03-28 16:40:55 -04:00
Robert Muir 11712a3364
remove unsupported snowball algorithms (#13230) 2024-03-28 16:37:18 -04:00
Trey Jones 69d846f700
Add Romanian stopwords with s&t with comma (#12172)
Romanian uses s&t with commas (ș/ț), but for a long time those weren't available, so s&t with cedilla (ş/ţ) were used. Both are still in use, but the comma forms are much more common now. Both should be supported in stopword lists.
2024-03-28 10:35:39 -04:00
Uwe Schindler f6d0834639 fix typo in older changes entry 2024-03-28 10:39:34 +01:00
Uwe Schindler 376ec27a51 #13206: Move changes entry to 9.11 2024-03-28 10:37:45 +01:00
Jean-François BOEUF 3917d22591
Subtract deleted file size from the cache size of NRTCachingDirectory. (#13206) 2024-03-28 10:34:46 +01:00
Robert Muir ad8545151d
upgrade snowball to 34f3612e5e8c (round two) (#13227)
* upgrade snowball to 34f3612e5e8c (round two)

* disable forbidden-apis on snowball code (thanks @uschindler)
2024-03-27 17:51:48 -04:00
Adrien Grand 96c0c3082a
Clean up variable-gaps terms format. (#13216)
The variable-gaps terms format uses the legacy storage layout of storing
metadata at the end of the index file, and storing the start pointer of the
metadata as the last 8 bytes of the index files (just before the footer). This
forces an awkward access pattern at open time when we first need to seek
towards the end to check that a footer is present, then seek some more bytes
backwards to read metadata, and finally read the content of the index that sits
before metadata.

To fix this, meta data and index data are now split into different files. This
way, both files have a clean sequential and read-once access pattern, and can
take advantage of the `ChecksumIndexInput` abstraction for checksum validation.

This further helps clean up `IOContext` by removing the ability to set
`readOnce` to `true` on an existing `IOContext`.
2024-03-27 18:16:30 +01:00
Robert Muir d54663ad76
upgrade snowball to 26db1ab9adbf437f37a6facd3ee2aad1da9eba03 (#13209)
* upgrade snowball to 26db1ab9adbf437f37a6facd3ee2aad1da9eba03

* add back-compat-hack to the factory, too

* remove open of irish package now that we don't have our own stopwords file here anymore

* CHANGES / MIGRATE
2024-03-27 10:05:57 -04:00
Adrien Grand 8558934501
Replace boolean flags on `IOContext` with an enum. (#13219)
This replaces the `load`, `randomAccess` and `readOnce` flags with a
`ReadAdvice` enum, whose values are aligned with the allowed values to
(f|m)advise.

Closes #13211
2024-03-27 09:13:41 +01:00
Zhang Chao 1f909baca5
Speed up writeGroupVInts (#13203)
* Speed up writeGroupVInts
2024-03-26 22:48:30 +08:00
Uwe Schindler 26f5065e15
Add support for Github issue numbers in Markdown converter (e.g., MIGRATE.md file) (#13215) 2024-03-26 13:45:56 +01:00
gf2121 99b9636fd8
Break point estimation when threshold exceeded (#13199) 2024-03-26 19:29:34 +08:00
Uwe Schindler 8c4ec1dbef
Convert IOContext, MergeInfo, and FlushInfo to record classes (#13205) 2024-03-26 12:27:51 +01:00
Chris Hegarty 209aa05c0c
Avoid creating large buffer in TestMMapDirectory.testWithRandom (#13214)
This commit avoids creating an unnecessary large buffer in TestMMapDirectory.testWithRandom.
2024-03-26 10:35:17 +00:00
Uwe Schindler 9fffc6e54c #13196, #13213: Remove logging relic from main branch 2024-03-26 10:09:29 +01:00
Uwe Schindler 61e5da3fe4 #13196, #13213: Fix test on windows to close file so it can be deleted after test run 2024-03-25 20:37:59 +01:00
Uwe Schindler a4055dae62
Add support for posix_madvise to Java 21 MMapDirectory (#13196) 2024-03-25 18:44:33 +01:00
Nhat Nguyen f4db67fae2
Avoid modify merge state in per field mergers (#13208)
The PerFieldDocValuesFormat and PerFieldPostingsFormat mutate and reset 
the fieldInfos of the mergeState during merges. Consequently, other 
running merge sub-tasks may fail to see some fieldInfos. This was
problematic since we introduced concurrency for merge sub-tasks.

Relates #13190
2024-03-25 08:56:41 -07:00
Tim Grein d5ef6edf7f
Only check the knn specific options, if a vector dictionary source was provided. (#13163) 2024-03-25 10:25:50 -04:00