Commit Graph

36741 Commits

Author SHA1 Message Date
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
Adrien Grand afc990cd2b
Fix lazy decoding of frequencies in `BlockImpactsDocsEnum`. (#12668)
The code was written as if frequencies should be lazily decoding, except that
when refilling buffers freqs were getting eagerly decoded instead of lazily.
2023-10-13 10:42:34 +02:00
Dawid Weiss 06341ffe1d GITHUB#12655: upgrade jacoco aggregation plugin (failed with gradle 8.x), change html output property. 2023-10-12 20:42:17 +02:00
Dawid Weiss a97d7a3e35 Adding Benjamin's readme change #12663 2023-10-12 20:30:58 +02:00
Dawid Weiss 603cd41ca1
Added JMH micro-benchmarks submodule (#12663) 2023-10-12 20:25:34 +02:00
Shubham Chaudhary 52dfe50e8f
Ability to compute vector similarity scores with DoubleValuesSource (#12548)
### Description

This PR addresses the issue #12394. It adds an API **`similarityToQueryVector`** to `DoubleValuesSource` to compute vector similarity scores between the query vector and the `KnnByteVectorField`/`KnnFloatVectorField` for documents using the 2 new DVS implementations (`ByteVectorSimilarityValuesSource` for byte vectors and `FloatVectorSimilarityValuesSource` for float vectors). Below are the method signatures added to DVS in this PR:

- `DoubleValues similarityToQueryVector(LeafReaderContext ctx, float[] queryVector, String vectorField)` *(uses ByteVectorSimilarityValuesSource)*
- `DoubleValues similarityToQueryVector(LeafReaderContext ctx, byte[] queryVector, String vectorField)` *(uses FloatVectorSimilarityValuesSource)*

Closes #12394
2023-10-12 13:34:37 -04:00
Simon Willnauer 268dd54a86
Cleanup flushing logic in DocumentsWriter (#12647)
DocumentsWriter had some duplicate logic for iterating over
segments to be flushed. This change simplifies some of the loops
and moves common code in on place. This also adds tests to ensure
we actually freeze and apply deletes on segment flush.

Relates to #12572
2023-10-12 16:49:39 +02:00
Uwe Schindler fad6653495
Fix Gradle toolchain download with Gradle 8.4 (#12655) (#12662) 2023-10-12 13:22:48 +02:00
Dawid Weiss 2e12a35c87 GITHUB#12655: javac options via -J only when the compiler is in forked mode. 2023-10-12 09:05:03 +02:00
Kevin Risden a8fba38f16
GITHUB#12655: Add google java format upgrade tidy / regen to blame ignore 2023-10-11 16:15:42 -04:00
Kevin Risden de3b294be4
GITHUB#12655: gradle tidy after google java format update for jdk 21 and regen
* tidy whitespace changes from googleJavaFormat upgrade
* generateForUtil fixed and regened https://bugs.python.org/issue39350
* generateAntlr
* generateClassicTokenizer
* generateWikipediaTokenizer
2023-10-11 16:12:09 -04:00
Kevin Risden 2c42b8941a
GITHUB#12655: Update googleJavaFormat plugin 2023-10-11 16:12:01 -04:00
Kevin Risden 30d3eba933
GITHUB#12655: Upgrade to Gradle 8.4
See https://github.com/apache/lucene/pull/12650 for details

Closes GITHUB#12655
2023-10-11 16:11:53 -04:00
Benjamin Trent 05d26ac44d
Refactor Lucene95 to allow off heap vector reader reuse (#12629)
While going through: https://github.com/apache/lucene/pull/12582

I noticed that for a while now, our offheap vector readers haven't changed at all. We just keep copying them around for no reason.

To make adding a new vector codec simpler, this refactors the lucene95 codec to allow its offheap vector storage format (readers/writers) to be used. 

Additionally, it will handle writing the appropriate fields for sparse vectors (read/write) to a provided index output/inputs.

This should reduce the churn in new codecs significantly.
2023-10-10 14:53:54 -04:00
Dzung Bui 04f38dd288
Move addNode to FSTCompiler (#12646)
Currently FSTCompiler and FST have circular dependencies to each 
other. FSTCompiler creates an instance of FST, and on adding node 
(add(IntsRef input, T output)), it delegates to FST.addNode() and passes
itself as a variable. This introduces a circular dependency and mixes up 
the FST constructing and traversing code.

To make matter worse, this implies one can call FST.addNode with an 
arbitrary FSTCompiler (as it's a parameter), but in reality it should be 
the compiler which creates the FST.

This commit moves the addNode method to FSTCompiler instead.

Co-authored-by: Anh Dung Bui <buidun@amazon.com>
2023-10-10 13:34:57 +01:00
gf2121 65d2227f83
Avoid duplicate array fill in BPIndexReorderer (#12645) 2023-10-10 15:10:09 +08:00
gf2121 4f01de2a2d
Write MSB VLong for better outputs sharing in block tree index (#12631) 2023-10-10 14:00:21 +08:00
gf2121 e20e245f47
DeletedTerms#clear should reset ByteBlockPool (#12630) 2023-10-10 13:42:17 +08:00
Patrick Zhai 33a3af4260 Add a little bit more hint to releaseWizard 2023-10-09 17:05:23 -03:00
Piotrek Żygieło dfff1e6358
Avoid NPEx if the end of the stream has been reached without reading any characters (#12611)
e.g. by user responding with ^D
```
Press (n)ext page, (q)uit or enter number to jump to a page.
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "String.length()" because "line" is null
	at org.apache.lucene.demo.SearchFiles.doPagingSearch(SearchFiles.java:244)
	at org.apache.lucene.demo.SearchFiles.main(SearchFiles.java:152)
```

```
Press (p)revious page, (n)ext page, (q)uit or enter number to jump to a page.
n
Only results 1 - 50 of 104 total matching documents collected.
Collect more (y/n) ?
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "String.length()" because "line" is null
	at org.apache.lucene.demo.SearchFiles.doPagingSearch(SearchFiles.java:198)
	at org.apache.lucene.demo.SearchFiles.main(SearchFiles.java:152)
```

Co-authored-by: Piotrek Żygieło <pzygielo@users.noreply.github.com>
2023-10-09 08:11:59 +02:00
Robert Muir ce3a904465
add tests for vectorutils integer boundaries (#12634) 2023-10-08 11:26:33 -04:00
Kaival Parikh 2474940bff
Allow implementers of AbstractKnnVectorQuery to access final topK results (#12590)
* Make AbstractKnnVectorQuery#createRewrittenQuery protected

* Add explicit method to merge per-segment results

* Add javadocs explaining the new method

* Run gradlew tidy

---------

Co-authored-by: Kaival Parikh <kaivalnp@amazon.com>
2023-10-05 15:14:59 -04:00