37509 Commits

Author SHA1 Message Date
Dawid Weiss
868897e43e Update WrapperDownloader to accept java 22 and correct deprecated new URL API #13458 2024-06-06 11:51:00 +02:00
Chris Hegarty
9a4caa935a
Update Gradle wrapper to 8.8 - supports Java 22 (#13453)
This commit updates the Gradle wrapper to 8.8, which has support for Java 22.
2024-06-06 08:46:18 +01:00
panguixin
fe50e86e36
Implement Weight#count for vector values in the FieldExistsQuery (#13322)
* implement Weight#count for vector values

* add change log

* apply review comment

* apply review comment

* changelog

* remove null check
2024-06-05 15:02:51 -04:00
Adrien Grand
05b4639c0c
Add prefetching for doc values and norms. (#13411)
This follows a similar approach as postings and only prefetches the first page
of data.

I verified that it works well for collectors such as `TopFieldCollector`, as
`IndexSearcher` first pulls a `LeafCollector`, then a `BulkScorer` and only
then starts feeding the `BulkScorer` into the `LeafCollector`. So the
background I/O for the `LeafCollector` which will prefetch the first page of
doc values and the background I/O for the `BulkScorer` will run in parallel.
2024-06-05 13:43:14 +02:00
Adrien Grand
846aa2f8c3
Use ReadAdvice#NORMAL on files that have a forward-only access pattern. (#13450)
This applies to files where performing readahead could help:
 - Doc values data (`.dvd`)
 - Norms data (`.nvd`)
 - Docs and freqs in postings lists (`.doc`)
 - Points data (`.kdd`)

Other files (KNN vectors, stored fields, term vectors) keep using a `RANDOM`
advice.
2024-06-05 13:41:58 +02:00
Ioana Tagirta
e868b82045
Rewrite newSlowRangeQuery to MatchNoDocsQuery when upper > lower (#13425) 2024-06-04 18:38:50 +02:00
Zhang Chao
801b822972
Avoid unnecessary memory allocation in PackedLongValues#Iterator (#13439)
We always allocate a long array of page size for a new PackedLongValues#Iterator instance, which is not necessary when packing a small number of values. this is more evident in the scenario of high-frequency flush operations
2024-06-04 13:03:09 +08:00
Michael Sokolov
c132e95369
mention KnnVectorsFormat in o.a.l.codecs package javadocs (#13448)
Co-authored-by: Michael Sokolov <sokolovm@amazon.com>
2024-06-03 11:27:41 -04:00
Adrien Grand
edd7747370
Add prefetching support to stored fields. (#13424)
This adds `StoredFields#prefetch(int)`, which mostly delegates to
`IndexInput#prefetch`. Callers can take advantage of this API to parallelize
I/O across multiple stored documents by first calling `StoredFields#prefetch`
on all doc IDs before calling `StoredFields#document` on all doc IDs.

I added a cache of recently prefetched blocks to the default codec, in order to
avoid prefetching the same block multiple times in a short period of time. This
felt sensible given that doc ID reordering via recursive graph bisection or
index sorting are likely to result in search results being clustered.
2024-06-03 09:25:23 +02:00
Zhang Chao
a6f920d989
Fix test failure on TestPoint#testEqualsAndHashCode (#13433) 2024-06-03 10:43:01 +08:00
Benjamin Trent
a540027bde
Add new dynamic confidence interval configuration to scalar quantized format (#13445)
When int4 scalar quantization was merged, it added a new way to dynamically calculate quantiles.

However, when that was merged, I inadvertently changed the default behavior, where a null confidenceInterval would actually calculate the dynamic quantiles instead of doing the previous auto-setting to 1 - 1/(dim + 1).

This commit formalizes the dynamic quantile calculate through setting the confidenceInterval to 0, and preserves the previous behavior for null confidenceIntervals so that users upgrading will not see different quantiles than they would expect.
2024-06-01 13:25:38 -04:00
Chris Hegarty
f3c2b91630
SimpleText[Float|Byte]VectorValues::scorer should return null when the vector values is empty (#13444)
This commit ensures that SimpleText[Float|Byte]VectorValues::scorer returns null when the vector values is empty, as per the scorer javadoc. Other KnnVectorsReader implementations have specialised empty implementations that do similar, e.g. OffHeapFloatVectorValues.EmptyOffHeapVectorValues. The VectorScorer interface in new in Lucene 9.11, see #13181

An existing test randomly hits this, but a new test has been added that exercises this code path consistently. It's also useful to verify other KnnVectorsReader implementations.
2024-05-31 14:27:25 +01:00
Adrien Grand
750a7c4d3b
Fix TestIndexWriterOnError.testIOError failure. (#13436)
Pull request #13406 inadvertly broke Lucene's handling of tragic exceptions by
stopping after the first `DocValuesProducer` whose `close()` calls throws an
exception, instead of keeping calling `close()` on further producers in the
list.

This moves back to the previous behavior.

Closes #13434
2024-05-29 22:08:10 +02:00
Benjamin Trent
9a3dbd5dd7 Add next minor version 9.12.0 2024-05-29 14:46:31 -04:00
Stefan Vodita
b3dc9153bb
Allow users to retrieve counts from taxo association facets (#13414)
Add a count field to LabelAndValue
2024-05-29 07:55:37 +01:00
Amir Raza
ea0646d094
Fixes failing test case for TestOrdinalMap.testRamBytesUsed (#13421) 2024-05-28 18:53:08 +02:00
Peter Gromov
54d3ff64bc
hunspell: speed up "compress"; minimize the number of the generated entries; don't even consider "forbidden" entries anymore (#13429)
Hunspell: speed up "compress"; minimize the number of the generated entries; don't even consider "forbidden" entries anymore
2024-05-28 18:09:40 +02:00
Uwe Schindler
4438404457 Remove useless SPI "uses" clause after previous commit 2024-05-28 00:21:13 +02:00
Uwe Schindler
b1189adeb3
Remove incorrect/expensive use of ServiceLoader for choosing random format (#13428) 2024-05-27 23:59:28 +02:00
Ben Chaplin
c06fff6a52
Add test for parsing brackets in range queries (#13323) 2024-05-27 20:34:05 +02:00
Navneet Verma
6efce2189e
Add support for reloading the SPI for KnnVectorsFormat class (#13394)
Signed-off-by: Navneet Verma <navneev@amazon.com>
2024-05-27 18:56:05 +02:00
Chris Hegarty
80304802a5
Fix duplicate values in org.apache.lucene.analysis.ko.dict.UserDictionary (#13427)
Remove incorrect assertion in org.apache.lucene.analysis.ko.dict.UserDictionary, and replace with array copy if duplicate values are passed.
2024-05-27 17:53:01 +01:00
Chris Hegarty
944624b644
MemorySegment scorer should ensure that the values is of the correct type (#13423)
This commit updates the MemorySegment scorer so that it ensures the values is of the correct type.

The offset calculations for vectors in RandomAccessQuantizedByteVectorValues will be different than that of non-quantized. We can generalise the implementation for quantized vectors later, but for now, passing a quantised values indicated bug in wrapping or delegation.
2024-05-27 17:19:16 +01:00
Bruno Roustant
f394c9418e
Remove the HPPC dependency from all modules and move the HPPC fork to internal. (#13422)
* Remove hppc dependency
* Change fork version to 0.10.0
* Add @lucene.internal
* Move hppc classes to oal.internal.hppc but export it.
* Delete hppc license since it's no longer a dependency.

---------

Co-authored-by: Dawid Weiss <dawid.weiss@carrotsearch.com>
2024-05-27 12:09:25 +02:00
Adrien Grand
ddf538d43e
Move bulkScorer() from Weight to ScorerSupplier (#13408)
This relates to #13359: we want to take advantage of the `Weight#scorerSupplier` call to start scheduling some I/O in the background in parallel across clauses. For this to work properly with top-level disjunctions, we need to move `#bulkScorer()` from `Weight` to `ScorerSupplier` as well, so that the disjunctive `BooleanQuery` first performs a call to `Weight#scorerSupplier()` on all inner clauses, and then `ScorerSupplier#bulkScorer` on all inner clauses.

`ScorerSupplier#get` and `ScorerSupplier#bulkScorer` only support being called once. This forced me to fix some inefficiencies in `bulkScorer()` implementations when we would pull scorers and then throw it away when realizing that the strategy we were planning on using was not optimal. This is why e.g. `ReqExclBulkScorer` now also supports prohibited clauses that produce a two-phase iterator.
2024-05-27 09:56:26 +02:00
Bruno Roustant
6e2a8fc9b7
Replace Map<Character> by CharObjectHashMap and Set<Character> by CharHashSet. (#13420)
Also optimize the character replacement in JapaneseKatakanaUppercaseFilter.
2024-05-27 08:44:23 +02:00
Bruno Roustant
444d4e7c42
Replace List<Integer> by IntArrayList and List<Long> by LongArrayList. (#13406) 2024-05-25 19:53:42 +02:00
David Smiley
90e07f6664
gradlew: no "--source 11" (#13404)
* avoid WrapperDownloader if have the JAR
* don't specify --source
More specific than needed, and some JDK/configs may complain about an incompatibility with --release.

From https://github.com/apache/solr/pull/2419
2024-05-24 18:19:53 -04:00
Christine Poerschke
be513cf515 (fix precommit) lucene-monitor: remove unused import in ReadonlyQueryIndex 2024-05-24 18:14:44 +01:00
Christine Poerschke
40f674c5d3
lucene-monitor: replace wildcard imports (#13413) 2024-05-24 17:36:14 +01:00
Christine Poerschke
8dad226afa
lucene-monitor: remove now-unused Scorable in QueryIndex.DataValues (#13412) 2024-05-24 17:35:55 +01:00
Adrien Grand
9ecf566cca
Remove unchecked Scorable -> Scorer cast in lucene/monitor. (#13405)
While doing an unrelated refactoring, I got hit by this unchecked cast, which
is incorrecw when the presearcher query produces some specialized `BulkScorer`.
2024-05-24 09:36:38 +02:00
정승한(Seunghan Jung)/Search Platform
8773725ac0
UnifiedHighlighter: new passageSortComparator option (#13276)
new 'passageSortComparator' option to allow sorting other than offset order
2024-05-23 13:45:17 -04:00
Bruno Roustant
d078fb774d
Replace Set<Integer> by IntHashSet and Set<Long> by LongHashSet (#13400)
Also rename lucene.document.LongHashSet to DocValuesLongHashSet.
2024-05-23 16:25:52 +02:00
Chris Hegarty
05f04aa08a
Add a MemorySegment Vector scorer - for scoring without copying on-heap (#13339)
Add a MemorySegment Vector scorer - for scoring without copying on-heap.

The vector scorer loads values directly from the backing memory segment when available. Otherwise, if the vector data spans across segments the scorer copies the vector data on-heap.

A benchmark shows ~2x performance improvement of this scorer over the default copy-on-heap scorer.

The scorer currently only operates on vectors with an element size of byte. We can evaluate if and how to support floats separately.
2024-05-21 17:34:37 +01:00
Bruno Roustant
f70999980c
Replace Map<Long, Object> by primitive LongObjectHashMap. (#13392)
Add LongObjectHashMap and replace Map<Long, Object>.
Add LongIntHashMap and replace Map<Long, Int>.
Add HPPC dependency to join and spatial modules for primitive values float and double.
2024-05-21 17:11:34 +02:00
Adrien Grand
5b1a34bddd
Fix max score computation in BlockMaxConjunctionBulkScorer. (#13397)
It sums up max scores in a float when it should sum them up in a double like we
do for `Scorer#score()`. Otherwise, max scores may be returned that are less
than actual scores.

This bug was introduced in #13343, so it is not released yet.

Closes #13371
Closes #13396
2024-05-21 11:51:59 +02:00
Alessandro Benedetti
da6bd22fd9 Revert "Vectors Format Refactor first draft"
This reverts commit 77cec4442306cf5410ff80f1739403e84ff6ae0f.
2024-05-21 11:32:26 +02:00
Alessandro Benedetti
77cec44423 Vectors Format Refactor first draft 2024-05-21 11:30:13 +02:00
Alan Woodward
92420d345a
Add Intervals.noIntervals() method (#13389)
Parsers may sometimes want to create an IntervalsSource that returns no
intervals.  This adds a new factory method to `Intervals` that will create one,
and changes `IntervalBuilder` to use it in place of its custom empty intervals
source.
2024-05-21 09:22:44 +01:00
Adrien Grand
aac856a831
Reduce the overhead of IndexInput#prefetch when data is cached in RAM. (#13381)
As Robert pointed out and benchmarks confirmed, there is some (small) overhead
to calling `madvise` via the foreign function API, benchmarks suggest it is in
the order of 1-2us. This is not much for a single call, but may become
non-negligible across many calls. Until now, we only looked into using
prefetch() for terms, skip data and postings start pointers which are a single
prefetch() operation per segment per term.

But we may want to start using it in cases that could result into more calls to
`madvise`, e.g. if we start using it for stored fields and a user requests 10k
documents. In #13337, Robert wondered if we could take advantage of `mincore()`
to reduce the overhead of `IndexInput#prefetch()`, which is what this PR is
doing via `MemorySegment#isLoaded()`.

`IndexInput#prefetch` tracks consecutive hits on the page cache and calls
`madvise` less and less frequently under the hood as the number of consecutive
cache hits increases.
2024-05-21 09:12:44 +02:00
expani1729
22d50be2ea
Make IntervalBuilder.NO_INTERVALS public (#13385)
This is generally useful for clients building their own Intervals
implementations.
2024-05-20 13:51:51 +01:00
gf2121
1ee4f8a111
Disjunction as CompetitiveIterator for numeric dynamic pruning (#13221)
// nightly-benchmarks-results-changed //
2024-05-20 15:00:09 +08:00
Bruno Roustant
7db9c8c9bd
Replace Map<Integer, Object> by primitive IntObjectHashMap. (#13368) 2024-05-18 14:40:40 +02:00
Tim Grein
24fd426d98
Fix TestHnswByteVectorGraph.testSortedAndUnsortedIndicesReturnSameResults (#13361)
Considering that the graphs of 2 indices are organized differently we need to explore a lot of candidates to ensure that both searchers find the same docs. Increasing beamWidth (number of nearest neighbor candidates to track while searching the graph for each newly inserted node) from 5 to 10 fixes the test.
2024-05-17 17:23:38 +01:00
Zhang Chao
22ddd481f0
Fix IntegerOverflow exception in postings encoding as group-varint (#13376)
The exception happen because the tail postings list block, which encoding with GroupVInt, had a docID delta that was >= 1<<30, when the postings are also storing freqs.
2024-05-17 23:43:23 +08:00
Christine Poerschke
2c81649e28
lucene-monitor: make TermFilteredPresearcher.ANYTOKEN[_FIELD] public (#13379) 2024-05-17 11:26:08 +01:00
Adrien Grand
c5331df1c4
Use IndexInput#prefetch for postings, skip data and impacts (#13364)
This uses the `IndexInput#prefetch` API for postings. This relies on heuristics, as we don't know ahead of time what data we will need from a postings list:
 - Postings lists are prefetched entirely when they are short (< 16kB).
 - Impacts enums also prefetch the first page of skip data.
 - Postings enums prefetc skip data on the first call to advance().

Positions, offsets and payloads are never prefetched.

Putting the `IndexInput#prefetch` call in `TermsEnum#postings` and `TermsEnum#impacts` works well because `BooleanQuery` will first create postings/impacts enums for all clauses before it starts unioning/intersecting them. This allows the prefetching logic to run in parallel across all clauses of the same query on the same segment.
2024-05-17 09:07:07 +02:00
Chris Hegarty
3d671a0fbe
Fix bug in SQ when just a single vector present in a segment (#13374)
This commit fixes a corner case in the ScalarQuantizer when just a single vector is present. I ran into this when updating a test that previously passed successfully with Lucene 9.10 but fails in 9.x.

The score error correction is calculated to be NaN, as there are no score docs or variance.
2024-05-16 14:59:56 +01:00
Chris Hegarty
731cecf730
Fix points writing with no values (#13378)
This commit updates the writer to handle the case where there are no values.

Previously (before #13369), there was a check that there were some points values before trying to write, this is no longer the case. The code in writeFieldNDims has an assumption that the values is not empty - an empty values will result in calculating a negative number of splits, and a negate array size to hold the splits.

The fix is trivial, return null when values is empty - null is an allowable return value from this method. Note: writeField1Dim is able to handle an empty values.
2024-05-16 14:24:00 +01:00