Commit Graph

37735 Commits

Author SHA1 Message Date
bjacobowitz 926d8f4ce6
Make CandidateMatcher functions public (#13632)
A number of functions in CandidateMatcher are protected or package-protected,
meaning that client code can't use them, which makes it difficult to build custom 
wrapper matchers.  This commit makes these functions public
2024-08-07 15:28:06 +01:00
Benjamin Trent 9e831ee809
Add float|byte vector support to memory index (#13633)
* Add float|byte vector support to memory index

* adding changes
2024-08-07 08:38:41 -04:00
Adrien Grand 82210189ee Add missing test for Lucene912PostingsFormat. 2024-08-06 14:30:03 +02:00
Kaival Parikh e0e5d81df8
Add timeout support to AbstractVectorSimilarityQuery (#13285)
Co-authored-by: Kaival Parikh <kaivalnp@amazon.com>
2024-08-05 17:12:19 -07:00
Benjamin Trent 43c80117dd
Fix ScalarQuantization when used with COSINE similarity (#13615)
When quantizing vectors in a COSINE vector space, we normalize them. However, there is a bug when building the quantizer quantiles and we didn't always use the normalized vectors. Consequently, we would end up with poorly configured quantiles and recall will drop significantly (especially in sensitive cases like int4).

closes: #13614
2024-08-05 12:29:14 -04:00
Mayya Sharipova 26b46ced07
KMeans clustering algorithm (#13604)
Implement Kmeans clustering algorithm for vectors.
Knn algorithms that further reduce memory usage of vectors (such as Product Quantization,
 RaBitQ etc) require clustering of vectors. This implements KMeans clustering algorithm.

Co-authored-by: Jim Ferenczi jim.ferenczi@elastic.co
2024-08-02 11:59:16 -04:00
zhouhui cb8bc75750
Rename prefix to prefixLength, suffix to suffixLength. (#13629) 2024-08-02 08:12:34 -07:00
Jakub Slowinski 1ce1156de4
Fix failing unit test - TestTopDocsCollector#testResultsOrder (#13621) 2024-08-02 14:03:09 +02:00
Zhang Chao ad2f02c013
Fix testAddDocumentOnDiskFull to handle IllegalStateException from IndexWriter#close (#13558) 2024-08-02 15:28:03 +08:00
Greg Miller 35a5d7323b CHANGES entry for GH#13625 2024-08-01 19:19:20 -07:00
Greg Miller 99f35e3f8b
Remove some BitSet#nextSetBit code duplication (#13625) 2024-08-01 19:16:39 -07:00
Benjamin Trent 836c8e76ad
Revert cosine deprecation (#13613)
Opening for more pointed discussion. See latest discussion here: #13281

I was hoping to have a full answer for folks who use byte models by Lucene 10, but I just don't have that.

I still want to remove the internal cosine optimized methods. We can do this if we store magnitudes along side the raw vectors. This way we can remove all the internal optimized cosine code as its complicated.
2024-08-01 15:05:05 -04:00
Michael Sokolov 2f297b7735 Add CHANGES entry for GH-13581 2024-08-01 10:30:31 -04:00
Adrien Grand 44a9133824 Fix lazy decoding of freqs. (#13585) 2024-08-01 16:25:45 +02:00
Michael Sokolov f14eb2b2c5
HnswLock: access locks via hash and only use for concurrent indexing (#13581)
hnswlock: hash locks and only use for concurrent indexing
2024-08-01 10:22:56 -04:00
Greg Miller 3ee85a46af Move CHANGES entry for GH#13559 from 10.0 to 9.12 2024-08-01 07:15:35 -07:00
Egor Potemkin e8eba4d455
SparseFixedBitSet#firstDoc: reduce number of `indices` iterations for a bit set that is not fully built yet. (#13559) 2024-08-01 07:11:58 -07:00
Adrien Grand 0a24769850 Don't clone an IndexInput if postings are inlined in the terms dict (#13585). 2024-08-01 12:55:06 +02:00
Armin Braun 47650a4314
Deduplicate min and max term in single-term FieldReader (#13618)
I noticed that single-term readers are an edge case but not that
uncommon in Elasticsearch heap dumps. It seems quite common to have a
constant value for some field across a complete segment (e.g. a version
value that is repeated endlessly in logs).
Seems simple enough to deduplicate here to save a couple MB of heap.
2024-07-31 20:38:21 +02:00
Armin Braun ca098e63b9
Deduplicate bytes for `FieldReader#rootCode` (#13610)
Looking at how these instances are serialized to disk it appears
that the empty output in the FST metadata is always the same as the
rootCode bytes.
Without changing the serialization we could at least deduplicate here,
saving hundreds of MB in some high-segment count use cases I observed in
ES.
2024-07-31 20:31:13 +02:00
Jakub Slowinski 255a2fcf9c
Fix comments containing 'the this' (#13624) 2024-07-31 11:00:34 -07:00
Armin Braun a1816e3f65
Wrap Executor in TaskExecutor to never reject (#13622)
Make it so rejected tasks are execute right away on the caller thread.
Users of the API shouldn't have to worry about rejections when we don't
expose any upper limit to the task count that we put on the executor that
would help in sizing a queue for the executor.
2024-07-31 19:34:35 +02:00
Adrien Grand b4a8810b7a
Inline skip data into postings lists (#13585)
This updates the postings format in order to inline skip data into postings. This format is generally similar to the current `Lucene99PostingsFormat`, e.g. it shares the same block encoding logic, but it has a few differences:
 - Skip data is inlined into postings to make the access pattern more sequential.
 - There are only 2 levels of skip data: on every block (128 docs) and every 32 blocks (4,096 docs).

In general, I found that the fact that skip data is inlined may slow down a bit queries that don't need skip data at all (e.g. `CountOrXXX` tasks that never advance of consult impacts) and speed up a bit queries that advance by small intervals. The fact that the greatest level only allows skipping 4096 docs at once means that we're slower at advancing by large intervals, but data suggests that it doesn't significantly hurt performance.
2024-07-31 17:18:28 +02:00
Adrien Grand 5226e282b4
Add test that the default codec parallelizes I/O. (#13579)
This adds a Directory wrapper that counts how many times we wait for I/O to
complete before doing something else, and adds tests that the default codec is
able to parallelize I/O for stored fields retrieval and term lookups.
2024-07-31 17:11:44 +02:00
Luca Cavanna 30c965ea57
Introduce IndexSearcher#searchLeaf(LeafReaderContext, Weight, Collector) method (#13603)
There's a couple of places in the codebase where we extend `IndexSearcher` to customize
per leaf behaviour, and in order to do that, we need to override the entire search method
that loops through the leaves. A good example is `ScorerIndexSearcher`.

Adding a `searchLeaf` method that provides the per leaf behaviour makes those cases a little
easier to deal with.
2024-07-30 17:17:27 +02:00
Luca Cavanna 68aa629f6c Move changes entry for #13499 to API changes 2024-07-30 11:36:28 +02:00
Jakub Slowinski 74865bb92a
Removing all deprecated TopScoreDocCollector + TopFieldCollector methods (#create, #createSharedManager) (#13617)
These are already marked for deprecation in 9.x and we previously removed all internal use of these methods in 10.0.

Closes #13499
2024-07-30 11:33:16 +02:00
Jakub Slowinski 8a7d4842cc
Remove usage of TopScoreDocCollector + TopFieldCollector deprecated methods (#create, #createSharedManager) (#13500)
These methods were deprecated in #240 which is part of Lucene 10.0.

Addresses #13499
2024-07-29 11:05:55 +02:00
Peter Gromov 481ca2d30f
hunspell: add Suggester#proceedPastRep to avoid losing relevant suggestions (#13612)
* hunspell: add Suggester#proceedPastRep to avoid losing relevant suggestions
2024-07-27 21:39:00 +02:00
Adrien Grand 8d4f7a6e99
Bump the window size of disjunction from 2,048 to 4,096. (#13605)
It's been pointed multiple times that a difference between Tantivy and Lucene
is the fact that Tantivy uses windows of 4,096 docs when Lucene has a 2x
smaller window size of 2,048 docs and that this might explain part of the
performance difference. luceneutil suggests that bumping the window size to
4,096 does indeed improve performance for counting queries, but not for top-k
queries. I'm still suggesting to bump the window size across the board to keep
our disjunction scorer consistent.
2024-07-25 15:38:21 +02:00
Chris Hegarty b4fb425c43
Aggregate files from the same segment into a single Arena (#13570)
This commit adds a ref counted shared arena to support aggregating segment files into a single Arena.
2024-07-25 10:12:02 +01:00
Armin Braun 4c1d50d8e8
Save allocating some zero length byte arrays (#13608)
Something I found in a heap dump. For large numbers of `FieldReader`
where the minimum term is an empty string, we allocate MBs worth of
empty `byte[]` in ES. Worth adding the conditional here I think.
2024-07-24 21:53:30 +02:00
Adrien Grand acbd714140
Further reduce the search concurrency overhead. (#13606)
This iterates on #13546 to further reduce the overhead of search concurrency by
caching whether the hit count threshold has been reached: once the threshold
has been reached, it cannot get "un-reached" again, so we don't need to pay the
cost of `LongAdder#longValue`.
2024-07-24 14:58:53 +02:00
Luca Cavanna 97d066dd6b
Update TestTopDocsMerge to not rely on search(Query, Collector) (#13601)
Relates to #12892
2024-07-24 13:07:08 +02:00
Luca Cavanna d491dfe131
Update TestTopDocsCollector to no longer rely on the deprecated search(Query, Collector) (#13600) 2024-07-24 13:06:31 +02:00
Dzung Bui 97d89c661f
Refactor FST.saveMetadata() to FSTMetadata.save() (#13549)
* lazily write the FST padding byte

* Also write the pad byte when there is emptyOutput

* add comment

* Make Lucene90BlockTreeTermsWriter to write FST off-heap

* Add change log

* Tidy code & Add comments

* use temp IndexOutput for FST writing

* Use IOUtils to delete files

* Update CHANGES.txt

* Update CHANGES.txt
2024-07-22 12:14:53 -04:00
Michael McCandless af9a2b9803
Add simple tool to diff entries in lucene's CHANGES.txt that should be identical (#12860)
* add simple tool to diff entries in lucene's CHANGES.txt that should be identical

* remove temporary debugging code
2024-07-22 11:37:34 -04:00
Mike McCandless 1c3925cb15 reconcile main's copy to match 9.10.0 released CHANGES.txt entry 2024-07-22 11:37:01 -04:00
Ignacio Vera 7709f575ef
Align doc value skipper interval boundaries when an interval contains a constant value (#13597)
keep adding documents to an skipper interval while it is dense and single valued.
2024-07-22 14:52:44 +02:00
Adrien Grand cc3b412183 Fix test failure 2024-07-19 15:18:21 +02:00
Ignacio Vera 9f991ed07e
Add levels to DocValues skipper index (#13563)
Adding levels o be able to skip several intervals in one step.
2024-07-19 11:20:16 +02:00
zhouhui c245ed2fb4
Remove useless todo. (#13589) 2024-07-19 10:12:52 +02:00
Nhat Nguyen b42fd8e479
Avoid wrap readers without soft-deletes (#13588)
I analyzed a heap dump of Elasticsearch where FixedBitSet uses more than 
1GB of memory. Most of these FixedBitSets are used by soft-deletes 
reader wrappers, even though these segments have no deletes at all. I
believe these segments previously had soft-deletes, but these deletes
were pruned by merges. The reason we wrap soft-deletes is that the
soft-deletes field exists. Since these segments had soft-deletes
previously, we carried the field-infos into the new segment. Ideally, we
should have ways to check whether the returned docValues iterator is
empty or not so that we can avoid allocating FixedBitSet completely, or
we should prune fields without values after merges.
2024-07-18 22:47:44 -07:00
Adrien Grand 00c9d9a03c Fix test failures due to #13517. 2024-07-18 11:52:16 +02:00
Adrien Grand 9f040864a6
Add a `targetSearchConcurrency` parameter to `LogMergePolicy`. (#13517)
This adds the same `targetSearchConcurrency` parameter to `LogMergePolicy`
that #13430 is adding to `TieredMergePolicy`.
2024-07-18 11:28:35 +02:00
Adrien Grand fff997f801
Stop requiring MaxScoreBulkScorer's outer window from having at least INNER_WINDOW_SIZE docs. (#13582)
Currently `MaxScoreBulkScorer` requires its "outer" window to be at least
`WINDOW_SIZE`. The intuition there was that we should make sure we should use
the whole range of the bit set that we are using to collect matches. The
downside is that it may force us to use an upper level in the skip list that
has worse upper bounds for the scores.
2024-07-18 11:23:19 +02:00
Carlos Delgado 22ca695ef5
Add target search concurrency to TieredMergePolicy (#13430) 2024-07-17 13:54:19 +02:00
Chris Hegarty 99488b2245
Ensure to use IOContext.READONCE when reading segment files (#13574)
This commit uses IOContext.READONCE in more places where the index input is clearly being read once by the thread opening it. We can then enforce that segment files are only opened with READONCE, in the test specific Mock directory wrapper.

Much of the changes in this PR update individual test usage, but there is one non-test change to Directory::copyFrom.
2024-07-17 08:56:11 +01:00
Mayya Sharipova 5e52b8094a
Add IntervalsSource for range and regexp queries (#13562)
We already have convenient functions for contructing IntervalsSource
for wildcard and fuzzy functions. This adds functions for
regexp and range as well.
2024-07-14 09:48:16 -04:00
Christine Poerschke c55d664b3e
in KnnVectorsWriter reduce code duplication w.r.t. MergedVectorValues.merge(Float|Byte)VectorValues (#13539)
Co-authored-by: Vigya Sharma <vigyaspeaks@gmail.com>
2024-07-12 10:48:10 +01:00