Commit Graph

37052 Commits

Author SHA1 Message Date
Chris Hegarty f2287e7ba6
Refactor the use of runFinalization in tests and benchmarks (#12768)
This commit refactors the usage of the deprecated System::runFinalization in tests and benchmarks, so that narrowly targeted suppressions can be added.
2023-11-13 10:21:53 +00:00
Adrien Grand 1930425ffa Tidy. 2023-11-13 10:23:19 +01:00
Adrien Grand c081cfa0ba Use a serial merge scheduler to avoid race conditions when checking for hasPendingMerges().
Closes #12763
2023-11-13 10:01:39 +01:00
Benjamin Trent 4e2ce76b3e Merge remote-tracking branch 'upstream/main' 2023-11-10 14:38:14 -05:00
Benjamin Trent fe0ccbd84a Fixing changes for GITHUB#12729 2023-11-10 14:37:56 -05:00
Patrick Zhai 72ec96b1d1
Fix NFAQuery in TestRegexpRandom2 (#12793) 2023-11-10 11:17:35 -08:00
Benjamin Trent a47ba3369f
Refactoring HNSW to use a new internal FlatVectorFormat (#12729)
Currently the HNSW codec does too many things, it not only indexes vectors, but stores them and determines how to store them given the vector type.

This PR extracts out the vector storage into a new format `Lucene99FlatVectorsFormat` and adds new base class called `FlatVectorsFormat`. This allows for some additional helper functions that allow an indexing codec (like HNSW) take advantage of the flat formats.

Additionally, this PR refactors the new `Lucene99ScalarQuantizedVectorsFormat` to be a `FlatVectorsFormat`.

Now, `Lucene99HnswVectorsFormat` is constructed with a `Lucene99FlatVectorsFormat` and a new `Lucene99HnswScalarQuantizedVectorsFormat` that uses `Lucene99ScalarQuantizedVectorsFormat`
2023-11-10 14:05:19 -05:00
Robert Muir c28d174cd7
script to run microbenchmarks across different ec2 instance types (#12787) 2023-11-10 12:31:10 -05:00
gf2121 d4583567e9
Cache buckets to speed up BytesRefHash#sort (#12784) 2023-11-10 16:13:41 +08:00
Patrick Zhai 904a994f66
Enable executing using NFA in RegexpQuery (#12767) 2023-11-09 23:12:42 -08:00
Egor Potemkin e1af4182d6
Fix random test TestDirectoryTaxonomyReader#TestDirectoryTaxonomyReader (#12790) 2023-11-09 14:08:44 -05:00
Uwe Schindler 41c19d8c7e Rename test to fit the name of MMapDirectory 2023-11-09 18:45:57 +01:00
Uwe Schindler 5b43384367
Redo #12707: Do not rely on isAlive() status of MemorySegment#Scope and make sure IndexInput#close() does not throw IllegalStateException and waits instead (#12785) 2023-11-09 18:40:10 +01:00
Mike McCandless 2cd66fb311 #12180: move CHANGES entry to 9.9.0 section 2023-11-09 10:36:43 -05:00
Egor Potemkin fb5f491643
Add TaxonomyReader#getBulkOrdinals method (#12180) (#12769) 2023-11-09 10:02:02 -05:00
Zhang Chao 570832eb74
Specialize arc store for continuous label in FST (#12748)
* init

* review fix and reuse duplicate code

* rebase

* tidy

* CHANGES.txt

* bump version

* rebase

* CHANGES.txt
2023-11-09 06:01:32 -05:00
Lu Xugang a71d64a598
Skip docs with Docvalues in NumericLeafComparator (#12405)
* Skip document by docValues

*When the queue is full with only one Comparator, we could better tune the maxValueAsBytes/minValueAsBytes. For instance, if the sort is ascending and bottom value is 5, we will use a range on [MIN_VALUE, 4].
---------

Co-authored-by: Adrien Grand <jpountz@gmail.com>
2023-11-09 13:05:28 +08:00
Stefan Vodita 8665014fa8
Clean up ordinal map in default SSDV reader state (#12454) 2023-11-08 17:07:22 -08:00
Kevin Rosendahl ddb01cacd4
Normalize written scalar quantized vectors when using cosine similarity (#12780)
### Description

When using cosine similarity, the `ScalarQuantizer` normalizes vectors when calculating quantiles and `ScalarQuantizedRandomVectorScorer` normalizes query vectors before scoring them, but `Lucene99ScalarQuantizedVectorsWriter` does not normalize the vectors prior to quantizing them when producing the quantized vectors to write to disk. This PR normalizes vectors prior to quantizing them when writing them to disk.

Recall results on my M1 with the `glove-100-angular` data set (all using `maxConn`: 16, `beamWidth` 100, `numCandidates`: 100, `k`: 10, single segment):
| Configuration | Recall | Average Query Duration |
|---------------|-------|-----------------| 
| Pre-patch no quantization | 0.78762 | 0.68 ms |
| Pre-patch with quantization | 8.999999999999717E-5 | 0.45 ms |
| Post-patch no quantization | 0.78762 | 0.70 ms |
| Post-patch with quantization | 0.66742 | 0.66 ms |
2023-11-08 14:26:48 -05:00
Mike McCandless 20d5de448a Revert "Copy directly between 2 ByteBlockPool to avoid double-copy (#12778)"
This reverts commit efd68f8165.
2023-11-08 11:14:32 -05:00
Dzung Bui efd68f8165
Copy directly between 2 ByteBlockPool to avoid double-copy (#12778)
* Copy directly between 2 ByteBlockPool to avoid double-copy

* Use TestUtil in test case

* Rename variables

* Rename methods
2023-11-08 11:09:45 -05:00
Jakub Slowinski f698f90171
Re-adding the backward_codecs.lucene90 TestPForUtil + TestForUtil (#12781)
Clean-up from adding the Lucene99PostingsFormat in https://github.com/apache/lucene/pull/12741
These test cases were moved to Lucene99 dir and I forgot to copy the unmodified versions for the backward_codecs.lucene90
2023-11-08 09:01:47 -05:00
Dawid Weiss c85529b2c0
TestIndexWriterOnVMError.testUnknownError times out (fixes potential IW deadlock on tragic exceptions). (#12751) 2023-11-08 09:47:19 +01:00
Jakub Slowinski f416b2b8b5
Fix nested link warning from renderSiteJavadoc (#12779) 2023-11-07 11:24:43 -05:00
Benjamin Trent 34d858fbbb Fix KnnQueryTestCase
Both testEuclidean and testExplain have vectors that result
in equal scores. Since we no longer tie break on vector ordinal
as it doesn't make sense when building the graph, the vectors returned
might be slightly different. This commit fixes the flaky nature of the
test.
2023-11-07 07:55:28 -05:00
Benjamin Trent e1ce1d692c
Stop exploring HNSW graph if scores are not getting better. (#12770)
I noticed while testing lower dimensionality and quantization, we would explore the HNSW graph way too much. I was stuck figuring out why until I noticed the searcher checks for distance equality (not just if the distance is better) when exploring neighbors-of-neighbors. This seems like a bad heuristic, but to double check I looked at what nmslib does. This pointed me back to this commit: nmslib/nmslib#106

Seems like this performance hitch was discovered awhile ago :).

This commit adjusts HNSW to only explore the graph layer if the distance is actually better.
2023-11-07 06:55:42 -05:00
Dzung Bui 3231028070
remove FST's BytesReader#reversed() (#12777) 2023-11-07 05:11:27 -05:00
Robert Muir eab3e502bb
disable vectors (and don't warn to add incubator module) for jvmci/graal (#12766) 2023-11-06 15:28:22 -05:00
Dzung Bui 0e9c23785e
Streamline FST constructors and make it fully read-only (#12758)
* Streamline FST constructors

* Let init return the FSTStore

* Change constructor visibility
2023-11-06 12:34:39 -05:00
Jakub Slowinski 8ae598bae5
Remove patching for doc blocks. (#12741)
* Change Postings back to using FOR in Lucene99PostingsFormat

We are still keeping PFOR for positions only.
This is a partial revert of https://github.com/apache/lucene/pull/69 which brings back ForDeltaUtil.

* fix merge commit

* Add forgotten forDeltaUtil calls to reader

* Addressing comments: adding Lucene90RWPostingsFormat + more

Also:
* Change to Changes.txt
* Removal of dead code which was only used in unit tests
* Removal of test code from PForUtil

* Changes.txt edit in right place now

* Apply suggestions from code review: `90 -> 99 refactoring`

Co-authored-by: gf2121 <52390227+gf2121@users.noreply.github.com>

* Remove decodeTo32 from ForUtil and regenerate

---------

Co-authored-by: gf2121 <52390227+gf2121@users.noreply.github.com>
2023-11-06 10:46:03 -05:00
Mike McCandless 3acc3c864a #12506: escape > in javadocs 2023-11-06 10:41:01 -05:00
Mike McCandless 2a31f2835c #12506: switch to TestUtil for random ints to be consistent with 9.x backport where Java 11 doesn't have this API 2023-11-06 08:41:06 -05:00
Stefan Vodita 6aed68f17a
Clean up ByteBlockPool (#12506)
* Clean up ByteBlockPool

1. Move slice functionality to a separate class, ByteSlicePool.
2. Add exception case if the requested slice size is larger than the
   block size.
3. Make pool buffers private instead of the comment asking not to modify it.
4. Consolidate setBytesRef methods with int offsets.
5. Simplify ramBytesUsed.
6. Update and expand comments and javadoc.

* Revert to long offsets in ByteBlockPool; Clean-up

* Remove slice functionality from TermsHashPerField

* First working test

* [Broken] Test interleaving slices

* Fixed randomized test

* Remove redundant tests

* Tidy

* Add CHANGES

* Move ByteSlicePool to oal.index
2023-11-06 08:12:16 -05:00
Chris Hegarty 8d4f9e50cb
Remove usage of deprecated java.util.Locale constructor (#12761)
This commit removes usages of the deprecated java.util.Locale constructor, replacing with Locale.Builder.
2023-11-06 08:06:45 +00:00
gf2121 1448015641
Use growNoCopy for SortingStoredFieldsConsumer#NO_COMPRESSION (#12733) 2023-11-06 15:41:07 +08:00
Uwe Schindler 382aa549a7
Limit vectorization API to Hotspot VMs (and rename some constants and fix Javadocs) (#12765) 2023-11-05 19:22:33 +01:00
Uwe Schindler 5358b7251e Fix OpenJ9 regression introduced by #12754 2023-11-05 10:53:49 +01:00
Robert Muir 40e55b0ce7
Speed up vectorutil float scalar methods, unroll properly, use fma where possible (#12737)
Co-authored-by: Uwe Schindler <uschindler@apache.org>
2023-11-04 19:25:58 -04:00
Dzung Bui b8a9b0ae29
Use value-based LRU cache in NodeHash (#12738)
* Use value-based LRU cache in NodeHash (#12714)

* tidy code

* Add a nocommit about OffsetAndLength

* Fix the readBytes method

* Use List<byte[]> instead of ByteBlockPool

* Move nodesEqual to PagedGrowableHash

* Add generic type

* Fix the count variable

* Fix the RAM usage measurement

* Use PagedGrowableWriter instead of HashMap

* Remove unused generic type

* Update the ramBytesUsed formula

* Retain the FSTCompiler.addNode signature

* Switch back to ByteBlockPool

* Remove the unnecessary assertion

* Remove fstHashAddress

* Add some javadoc

* Fix the address offset when reading from fallback table

* tidy code

* Address comments

* Add assertions
2023-11-04 11:24:49 -04:00
Chris Hegarty 5ef651fc4c
Replace usage of deprecated java.net.URL constructor with URI (#12755)
This commit replaces the usage of the deprecated java.net.URL constructor with URI, later converting toURL where necessary to interoperate with the URLConnection API.
2023-11-03 20:02:22 +00:00
Uwe Schindler a35573eed9
Refactor access to VM options and move some VM options to oal.util.Constants (#12754) 2023-11-03 20:55:36 +01:00
Dawid Weiss d6836d3d0e
tests.multiplier could be omitted in failed test reproduce line (#12752)
The default tests.multiplier passed from gradle was 1, but
LuceneTestCase tried to compute its default value from TESTS_NIGHTLY.
This could lead to subtle errors: nightly mode failures would not report
tests.multipler=1 and when started from the IDE, the tests.multiplier
would be set to 2 (leading to different randomness).
2023-11-03 17:05:17 +01:00
Mike McCandless 1f3f3ae14f fix comment: Test2BFST was exaggerating a bit about how big an FST it was really making 2023-11-03 07:45:45 -04:00
Adrien Grand 10ebd9025a Fix test after #12549 take 2. 2023-11-03 09:08:34 +01:00
Adrien Grand 43a568cb33
LUCENE-10560: Faster merging of TermsEnum (#1052)
Closes #11596
2023-11-03 08:55:15 +01:00
Michael Sokolov 4c9e241db3
Remove or repurpose obsolete JIRA tasks from release wizard (#11833) 2023-11-02 13:49:52 -04:00
Robert Muir 76aa38f7c0
Merge branch 'stabilize_benchmark' 2023-11-02 13:31:24 -04:00
zhouhui 2d50c345fe
Fix comment on decode method in PForUtil (#12495)
* Fix comment on decode method.

* Fix comment on decode method(lucene84).
2023-11-02 10:34:52 -04:00
twosom 30db217048
move CSVUtil to common from analyzer nori and kuromoji (#12390)
Closes #12389
2023-11-02 10:10:44 -04:00
Adrien Grand 5b87a31556
Speed up sorting on unique string fields. (#11903)
Since increasing the number of hits retrieved in nightly benchmarks from 10 to
100, the performance of sorting documents by title dropped back to the level it
had before introducing dynamic pruning. This is not too surprising given that
the `title` field is a unique field, so the optimization would only kick in
when the current 100th hit would have an ordinal that is less than 128 -
something that would only happen after collecting most hits.

This change increases the threshold to 1024, so that the optimization would
kick in when the current 100th hit has an ordinal that is less than 1024,
something that happens a bit sooner.
2023-11-02 14:16:11 +01:00