Commit Graph

37125 Commits

Author SHA1 Message Date
Chris Hegarty 5e1e6c9e68
Upgrade ECJ to 3.36.0 (#12888)
This commit upgrades ECJ to 3.36.0, as it has support for more recent Java versions, like Java 21.
2023-12-07 21:13:10 +00:00
Zach Chen fcc6f71f0e Move change entry for GITHUB#11041 from version 10.0.0 to version 9.10.0 2023-12-07 11:01:46 -08:00
Dawid Weiss 755de5aae3
Performance improvements to MatchHighlighter and MatchRegionRetriever (#12881) 2023-12-07 18:42:13 +01:00
Dzung Bui b699981847
Allow FST builder to use different writer (#12543) (#12624)
* Move size() to FSTStore

* Remove size() completely

* Allow FST builder to use different DataOutput

* access BytesStore byte[] directly for copying

* Rename BytesStore

* Change class to final

* Reorder methods

* Remove unused methods

* Rename truncate to setPosition() and remove skipBytes()

* Simplify the writing operations

* Update comment

* remove unused parameter

* Simplify BytesStore operation

* tidy code

* Rename copyBytes to writeTo

* Simplify BytesStore operations

* Embed writeBytes() to FSTCompiler

* Fix the write bytes method

* Remove the default block bits constant

* add assertion

* Rename method parameter names

* Move reverse to FSTCompiler

* Revert setPosition call

* Address comments

* Return immediately when writing 0 bytes

* Add comment &

* Rename variables

* Fix the compile error

* Remove isReadable()

* Remove isReadable()

* Optimize ReadWriteDataOutput

* tidy code

* Freeze the DataOutput once finished()

* Refactor

* freeze the DataOutput before use

* Address comments and add off-heap FST tests

* Remove the hardcoded random

* Ignore the Test2BFSTOffHeap test

* Simplify ReadWriteDataOutput

* Update Javadoc

* Address comments
2023-12-07 09:26:03 -05:00
Mike McCandless f55f2af0d0 SlowCompositeCodecWrapper: remove redundant FieldInfo lookup in its PointsReader.getValues method 2023-12-07 09:03:10 -05:00
Mike McCandless 4f1b967be9 #11023: move CHANGES entry down to 9.10 section 2023-12-07 06:45:40 -05:00
Jakub Slowinski 37cca614fc
CheckIndex - Removal of some dead code (#12876)
* CheckIndex - Remove some dead code

* Add back testPostings and testTermVectors
2023-12-07 06:34:33 -05:00
Uwe Schindler af2aea5eb2
Fix the declared Exceptions of Expression#evaluate() to match those of DoubleValues#doubleValue() (#12878) 2023-12-06 11:56:37 +01:00
Jakub Slowinski b22a9b8998
Removing TermInSetQuery varargs ctor (#12837) 2023-12-05 14:35:46 -08:00
Uwe Schindler 880d0ba1a8
Rewrite JavaScriptCompiler to use modern JVM features (Java 17) (#12873)
* Rewrite Javascript expression compiler to use hidden classes and MethodHandles for functions

* Use dynamic constants for MethodHandles

* Remove invokestatic code and handle everything through dynamic constants

* Rewrite code to patch stack trace (keep Expressions class unmodified)

* Improve generating of constant names

* Remove classloader test (no longer needed)

* Add benchmark

* use better exception in benchmark

* Add documentation, migration guide and a utility method to convert legacy function maps

* also ignore SecurityException here while checking compatibility (if it happens only an imprecise error message is thrown)

* Use Map.copyOf to not clone the map each time we compile an expression

* Add another test with same method multiple times

* Update ASM to 9.6 and set classfile version to Java 17

* Cleanup classloader permissions, unfortunately "createClassLoader" is still needed for Jacoco for God knows what
2023-12-05 11:53:57 +01:00
Chris Hegarty e852dfe550
Fix intermittently failing TestParallelLeafReader (#12865)
This commit fixes the intermittently failing TestParallelLeafReader.

The ParallelLeafReader requires the document order to be consistent across indexes - each document contains the union of the fields of all documents with the same document number. The test asserts this. But now, with MockRandomMergePolicy potentially reversing the doc ID order while merging, this invalidates the assumption of the test indexes and assertions. The solution is to just ensure that no merging actually happens in these tiny test indexes.
2023-12-02 10:02:13 +00:00
Kaival Parikh 65d30ca1af
Prevent extra similarity computation for single-level graphs (#12866)
### Description

[`#findBestEntryPoint`](4bc7850465/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphSearcher.java (L151)) is used to determine the entry point for the last level of HNSW search

It finds the single best-scoring node from [all upper levels](4bc7850465/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphSearcher.java (L159)) - but performs an [unnecessary computation](4bc7850465/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphSearcher.java (L157)) (along with [recording one visited node](4bc7850465/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphSearcher.java (L154))) when the graph just has 1 level (so the entry node is just the overall graph's entry node)

Also added a test to demonstrate this (fails without the changes in PR) -- where we visit `graph.size() + 1` nodes when the `topK` is high (should be a maximum of `graph.size()`)

---------

Co-authored-by: Kaival Parikh <kaivalp2000@gmail.com>
2023-12-01 13:02:00 -05:00
asubbu90 0e96b9cd8c
TruncateTokenFilterFactory now accepts lengths > 127 (#12507) 2023-12-01 12:01:29 -05:00
Lukáš Vlček ad0c9cca97
Improve Javadoc (#12508)
Remove duplicated line.

Signed-off-by: Lukáš Vlček <lukas.vlcek@aiven.io>
2023-12-01 11:45:17 -05:00
Chris Hegarty b231e5b213
Reconcile changelog 9.9.0 section (#12867)
Reconcile the changelog between branch_9_9 and main. This change just reorders a number of entries in main to match that of branch_9_9.
2023-12-01 14:15:01 +00:00
Jakub Slowinski 4bc7850465
Fix bug in UnescapedCharSequence and add basic unit tests (#12849) 2023-11-30 10:25:24 -08:00
Michael McCandless 00de0aef63 Avoid null PointValues when merging points in SlowCompositeCodecReaderWrapper (#12859)
* avoid null PointValues when merging points in SlowCompositeCodecReaderWrapper

* null check in SortingCodecReader

---------

Co-authored-by: ChrisHegarty <chegar999@gmail.com>
2023-11-30 09:01:19 -05:00
Chris Hegarty 7919133858
Fix intermittently failing TestSortedSetFieldSource (#12850)
This commit fixes the intermittently failing TestSortedSetFieldSource.

The test assertions depend on doc order which may be affected by merging. The fix is to trivially avoid merging for the very small index, with just two docs.
2023-11-30 08:39:26 +00:00
Mike McCandless 6ba38c13eb #12847: move CHANGES.txt entry to 9.9.0 to match backport 2023-11-29 06:34:24 -05:00
Dzung Bui bbf56f9419
Report the time it took for building the FST in Test2BFST (#12847)
* Report the time it took for building the FST

* Update CHANGES

* Change ramBytesUsed to numBytes

* Report the verification time

* Rename to fstSizeInBytes
2023-11-29 06:17:54 -05:00
Mike McCandless 8703b541a5 #240: disable threads in the random IndexSearcher from newSearcher for this test class 2023-11-28 19:37:21 -05:00
Benjamin Trent 2bb69f3246
Fix *HnswVectorsFormat.testIndexedValueNotAliased test flakiness (#12848) 2023-11-28 14:50:48 -05:00
ThomasDC 502f15a89b
Let WordDelimiterGraphFilterFactory propagate ignoreKeywords flag (#12525)
* Let WordDelimiterGraphFilterFactory propagate ignoreKeywords flag

fixes https://github.com/apache/lucene/issues/12522

* Document changes

* Align with default in code
2023-11-28 12:28:07 -05:00
Jakub Slowinski 203f506130
CheckIndex - Adding a `-level` parameter to give ability to control index check detail programmatically (#12797)
* CheckIndex - Making -fast the default behaviour

1. Making -fast the new default.
2. The previous -slow is moved to -slower
3. The previous default behavior (checksum + segment file content) is activated by -slow.

* gradlew tidy

* Add changes.txt

* Moved change to Lucene 10.0, now using -detailLevel param

* Fix failing test

* Add MIGRATE.md note and comment to remove deprecated params

* Fix failing unit test

* Changing detailLevel -> level

* catch invalid API calls

* Update lucene/core/src/java/org/apache/lucene/index/CheckIndex.java

Co-authored-by: Adrien Grand <jpountz@gmail.com>

---------

Co-authored-by: Adrien Grand <jpountz@gmail.com>
2023-11-28 12:19:31 -05:00
gf2121 9574cbd1f1
Optimize outputs accumulating for SegmentTermsEnum and IntersectTermsEnum (#12699) 2023-11-28 13:04:41 +08:00
Zach Chen 38ca8d3e42
LUCENE-10002: Deprecate IndexSearch#search(Query, Collector) in favor of IndexSearcher#search(Query, CollectorManager) - TopFieldCollectorManager & TopScoreDocCollectorManager (#240) 2023-11-27 16:16:31 -08:00
Uwe Schindler 17bb73332c
Only enable support for tests.profile if jdk.jfr module is available in Gradle runtime (#12845) 2023-11-25 20:16:09 +01:00
Ignacio Vera 74085cd1b0
Hide the internal data structure of HeapPointWriter (#12762) 2023-11-24 13:58:39 +01:00
Peter Gromov f460d612b5
hunspell: allow in-memory entry sorting for faster dictionary loading (#12834)
* hunspell: allow in-memory entry sorting for faster dictionary loading

Co-authored-by: Dawid Weiss <dawid.weiss@gmail.com>
2023-11-24 08:21:43 +01:00
Simon Willnauer 981339be04
Move MergeState.DocMap to a FunctionalInterface (#12836)
This change converts MergeState to an interface to make use of lambda expressions.
2023-11-23 20:39:15 +01:00
Adrien Grand 0ec7fdb3b5 Revert "Simplify advancing on postings/impacts enums (#12810)"
This reverts commit 5aa401e7d8.
2023-11-23 18:19:12 +01:00
Adrien Grand 14cee15c08 Fix test to preserve index order. 2023-11-23 13:37:56 +01:00
Adrien Grand 5aa401e7d8
Simplify advancing on postings/impacts enums (#12810) 2023-11-23 13:32:08 +01:00
Adrien Grand f7cab16450
Add a merge policy wrapper that performs recursive graph bisection on merge. (#12622)
This adds `BPReorderingMergePolicy`, a merge policy wrapper that reorders doc
IDs on merge using a `BPIndexReorderer`.
 - Reordering always run on forced merges.
 - A `minNaturalMergeNumDocs` parameter helps only enable reordering on the
   larger merged segments. This way, small merges retain all merging
   optimizations like bulk copying of stored fields, and only the larger
   segments - which are the most important for search performance - get
   reordered.
 - If not enough RAM is available to perform reordering, reordering is skipped.

To make this work, I had to add the ability for any merge to reorder doc IDs of
the merged segment via `OneMerge#reorder`. `MockRandomMergePolicy` from the
test framework randomly reverts the order of documents in a merged segment to
make sure this logic is properly exercised.
2023-11-23 13:25:00 +01:00
gf2121 76fe6bdbc1
Improve DirectReader java doc (#12835) 2023-11-23 17:19:57 +08:00
Michael Sokolov 74fe7f7fdf change-log entry for #12817 2023-11-22 17:13:01 -05:00
Stefan Vodita a3794ca6c2
Add KeywordField and StringValueFacetCounts example (#12817) 2023-11-22 11:32:05 -05:00
Adrien Grand 79cad27a42
Improve group-varint benchmark to reproduce value distribution of wikbigall. (#12833)
Instead of using a fixed number of bits per value, the group-varint benchmark
now tries to reproduce the distribution of the number of bits per values that
can be observed on tail postings of wikibigall.
2023-11-22 14:57:48 +01:00
Dzung Bui e04793d651
Remove FST constructors with DataInput for metadata (#12803)
* Remove FST constructor

* Move Outputs to FSTMetadata
2023-11-22 08:21:59 -05:00
Dzung Bui 9b324a180f
Make FSTCompiler.Builder build() throw IOException (#12830) 2023-11-22 07:54:55 -05:00
Adrien Grand 5bc608dbad
Skip decoding tail freqs when they are not needed. (#12832)
When we moved to group-varint for tail postings, we stop interleaving docs and
freqs and instead wrote all docs first, then all freqs. This means that we can
now skip decoding frequencies when they are not needed.
2023-11-22 10:05:41 +01:00
Shubham Chaudhary 4628327af0
Make TaskExecutor cx public and use TaskExecutor for concurrent HNSW graph build (#12799)
Make the TaskExecutor public which is currently pkg-private. At indexing time we concurrently create the hnsw graph (Concurrent HNSW Merge #12660). We could use the TaskExecutor implementation to do this for us.
Use TaskExecutor#invokeAll in HnswConcurrentMergeBuilder#build to run the workers concurrently.
2023-11-21 17:24:01 +01:00
Dzung Bui 4309917215
Remove FSTReader.size() (#12802)
* Move size() to FSTStore

* Remove size() completely

---------

Co-authored-by: Michael McCandless <mikemccand@apache.org>
2023-11-21 08:05:41 -05:00
Dzung Bui d0e0f6090e
Simplify BytesStore operation (#12814)
* Simplify BytesStore operations

* remove writeInt()
2023-11-21 07:26:47 -05:00
Evgeniy Mustafin 4991e3a1f4
Fix PayloadFilteredTermIntervalsSource equals (#12827)
Co-authored-by: Evgeniy Mustafin <evmustafin@ozon.ru>
2023-11-21 05:31:17 -05:00
Peter Gromov c23b3b3301
hunspell: a couple micro-optimizations to speed up dictionary loading (#12825)
* hunspell: a couple micro-optimizations to speed up dictionary loading

1. sort by the whole entry without searching for separators first: WordStorage doesn't require strong lexicographic order (only something close to it), and the separators are anyway before any usual word characters
2. avoid stream overhead when adding an entry
2023-11-21 08:05:42 +01:00
Mike McCandless 7eb8f6ee00 #12542, #12735, #12695, #12709, #12816: move CHANGES.txt entry from 10.0 -> 9.9.0 on bulk backport of recent FST improvements 2023-11-20 14:08:31 -05:00
Stefan Vodita 9de0936a7f
Fix off-by-one error in SimpleSortedSetFacetsExample (#12818) 2023-11-20 16:48:36 +00:00
Zhang Chao d0f63ec530
Use group-varint encoding for the tail of postings (#12782)
Co-authored-by: Adrien Grand <jpountz@gmail.com>
2023-11-20 11:06:13 +01:00
Adrien Grand 194a500323 Fix test failure on empty paged bytes. 2023-11-20 09:23:26 +01:00