Re: [PR] Enable error-prone checks for NonFinalStaticField [lucene]
rmuir commented on PR #14228: URL: https://github.com/apache/lucene/pull/14228#issuecomment-2670465446 @msfroh if you get a chance, I think you just need to merge in `main` and it will take care of that CI issue. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
Re: [PR] OptimisticKnnVectorQuery [lucene]
msokolov commented on code in PR #14226: URL: https://github.com/apache/lucene/pull/14226#discussion_r1962256467 ## lucene/core/src/java/org/apache/lucene/search/OptimisticKnnVectorQuery.java: ## @@ -0,0 +1,205 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.lucene.search; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.Callable; +import org.apache.lucene.codecs.lucene90.IndexedDISI; +import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.KnnVectorValues; +import org.apache.lucene.index.LeafReaderContext; +import org.apache.lucene.search.knn.KnnCollectorManager; +import org.apache.lucene.search.knn.KnnSearchStrategy; + +/** + * Like {@link KnnFloatVectorQuery} but makes an optimistic assumption about the distribution of + * documents among segments: namely that they are uniform-random w.r.t. vector distance. This is + * unsafe, so it checks the assumption after running the queries and runs a second pass if needed in + * any segments for which the assumption proves to be false. The check is simple: is the worst hit + * in the result queue for a segment in the global top K? If so, explore that segment further using + * seeded KNN search query, seeding with the initial results. + */ +// TODO: rename as float? move methods to AbstractKnnVectorQuery? make a Strategy? Replace existing +// collection strategy? +// yes, I think we should merge this stuff w/AbstractKnnVectorQuery, enable it with a +// KnnSearchStrategy, +// and extend KnnFloatVectorQuery/KnnByteVectorQuery in a simple way +public class OptimisticKnnVectorQuery extends KnnFloatVectorQuery { + + public OptimisticKnnVectorQuery(String field, float[] target, int k, Query filter) { +super(field, target, k, filter); + } + + public OptimisticKnnVectorQuery(String field, float[] target, int k) { +super(field, target, k, null); + } + + @Override + public Query rewrite(IndexSearcher indexSearcher) throws IOException { +IndexReader reader = indexSearcher.getIndexReader(); + +final Weight filterWeight; +if (filter != null) { + BooleanQuery booleanQuery = + new BooleanQuery.Builder() + .add(filter, BooleanClause.Occur.FILTER) + .add(new FieldExistsQuery(field), BooleanClause.Occur.FILTER) + .build(); + Query rewritten = indexSearcher.rewrite(booleanQuery); + filterWeight = indexSearcher.createWeight(rewritten, ScoreMode.COMPLETE_NO_SCORES, 1f); +} else { + filterWeight = null; +} + +TimeLimitingKnnCollectorManager knnCollectorManager = +new TimeLimitingKnnCollectorManager( +getKnnCollectorManager(k, indexSearcher), indexSearcher.getTimeout()); +TaskExecutor taskExecutor = indexSearcher.getTaskExecutor(); +List leafReaderContexts = new ArrayList<>(reader.leaves()); +List> tasks = new ArrayList<>(leafReaderContexts.size()); +for (LeafReaderContext context : leafReaderContexts) { + tasks.add(() -> searchLeaf(context, filterWeight, knnCollectorManager)); +} +TopDocs topK = null; +Map perLeafResults = new HashMap<>(leafReaderContexts.size()); +int kInLoop = k; +while (tasks.isEmpty() == false) { + List taskResults = taskExecutor.invokeAll(tasks); + for (int i = 0; i < taskResults.size(); i++) { +perLeafResults.put(leafReaderContexts.get(i).ord, taskResults.get(i)); + } + tasks.clear(); + // Merge sort the results + topK = mergeLeafResults(perLeafResults.values().toArray(TopDocs[]::new)); + if (topK.scoreDocs.length == 0 || perLeafResults.size() <= 1) { +break; + } + float minTopKScore = topK.scoreDocs[topK.scoreDocs.length - 1].score; + kInLoop *= 2; + TimeLimitingKnnCollectorManager knnCollectorManagerInner = + new TimeLimitingKnnCollectorManager( + new ReentrantKnnCollectorManager( + getKnnCollectorManager(kInLoop, indexSearcher), perLeafResults), + indexSearcher.getTimeout()); + // System.out.println("
Re: [PR] SortedSet DV Multi Range query [lucene]
mkhludnev commented on PR #13974: URL: https://github.com/apache/lucene/pull/13974#issuecomment-2669657925 It would be interesting to extend it to Numerics DVs and ranges aiming IP/masks -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
[I] TestIndexWriterMergePolicy.testStressUpdateSameDocumentWithMergeOnCommit fails on nightly [lucene]
benwtrent opened a new issue, #14261: URL: https://github.com/apache/lucene/issues/14261 ### Description This fails with an OOM on nightly. I wonder if we are just merging too much :). I suspect this is due to the tiered merge policy change, but I might be wrong. haven't ran gitbisect. ``` TestIndexWriterMergePolicy > testStressUpdateSameDocumentWithMergeOnCommit FAILED java.lang.OutOfMemoryError: GC overhead limit exceeded at org.apache.lucene.util.ArrayUtil.growExact(ArrayUtil.java:320) at org.apache.lucene.util.ArrayUtil.growInRange(ArrayUtil.java:346) at org.apache.lucene.util.ArrayUtil.grow(ArrayUtil.java:354) at org.apache.lucene.util.BytesRefArray.append(BytesRefArray.java:67) at org.apache.lucene.index.FieldUpdatesBuffer.append(FieldUpdatesBuffer.java:204) at org.apache.lucene.index.FieldUpdatesBuffer.addUpdate(FieldUpdatesBuffer.java:173) at org.apache.lucene.index.BufferedUpdates.addNumericUpdate(BufferedUpdates.java:139) at org.apache.lucene.index.DocumentsWriterDeleteQueue$DocValuesUpdatesNode.apply(DocumentsWriterDeleteQueue.java:504) at org.apache.lucene.index.DocumentsWriterDeleteQueue$DeleteSlice.apply(DocumentsWriterDeleteQueue.java:364) at org.apache.lucene.index.DocumentsWriterPerThread.prepareFlush(DocumentsWriterPerThread.java:398) at org.apache.lucene.index.DocumentsWriter.lambda$doFlush$9(DocumentsWriter.java:497) at org.apache.lucene.index.DocumentsWriter$$Lambda/0x03fc011b3758.get(Unknown Source) at org.apache.lucene.index.DocumentsWriterFlushQueue.addTicket(DocumentsWriterFlushQueue.java:43) at org.apache.lucene.index.DocumentsWriter.doFlush(DocumentsWriter.java:496) at org.apache.lucene.index.DocumentsWriter.maybeFlush(DocumentsWriter.java:456) at org.apache.lucene.index.DocumentsWriter.flushAllThreads(DocumentsWriter.java:649) at org.apache.lucene.index.IndexWriter.prepareCommitInternal(IndexWriter.java:3677) at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:4125) at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:4087) at org.apache.lucene.tests.index.RandomIndexWriter.commit(RandomIndexWriter.java:414) at org.apache.lucene.tests.index.RandomIndexWriter.commit(RandomIndexWriter.java:370) at org.apache.lucene.index.TestIndexWriterMergePolicy.stressUpdateSameDocumentWithMergeOnX(TestIndexWriterMergePolicy.java:808) at org.apache.lucene.index.TestIndexWriterMergePolicy.testStressUpdateSameDocumentWithMergeOnCommit(TestIndexWriterMergePolicy.java:747) at java.base/java.lang.invoke.LambdaForm$DMH/0x03fc01128000.invokeVirtual(LambdaForm$DMH) at java.base/java.lang.invoke.LambdaForm$MH/0x03fc010a8800.invoke(LambdaForm$MH) at java.base/java.lang.invoke.Invokers$Holder.invokeExact_MT(Invokers$Holder) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invokeImpl(DirectMethodHandleAccessor.java:153) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1758) at com.carrotsearch.randomizedtesting.RandomizedRunner$8.evaluate(RandomizedRunner.java:946) at com.carrotsearch.randomizedtesting.RandomizedRunner$9.evaluate(RandomizedRunner.java:982) com.carrotsearch.randomizedtesting.UncaughtExceptionError: Captured an uncaught exception in thread: Thread[id=20, name=Thread-3, state=RUNNABLE, group=TGRP-TestIndexWriterMergePolicy] Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded at __randomizedtesting.SeedInfo.seed([C13C284249671712]:0) at org.apache.lucene.util.ArrayUtil.growExact(ArrayUtil.java:320) at org.apache.lucene.util.ArrayUtil.growInRange(ArrayUtil.java:346) at org.apache.lucene.util.ArrayUtil.grow(ArrayUtil.java:354) at org.apache.lucene.index.FieldUpdatesBuffer.add(FieldUpdatesBuffer.java:144) at org.apache.lucene.index.FieldUpdatesBuffer.addUpdate(FieldUpdatesBuffer.java:175) at org.apache.lucene.index.BufferedUpdates.addNumericUpdate(BufferedUpdates.java:139) at org.apache.lucene.index.DocumentsWriterDeleteQueue$DocValuesUpdatesNode.apply(DocumentsWriterDeleteQueue.java:504) at org.apache.lucene.index.DocumentsWriterDeleteQueue$DeleteSlice.apply(DocumentsWriterDeleteQueue.java:364) at org.apache.lucene.index.DocumentsWriterPerThread.prepareFlush(DocumentsWriterPerThread.java:398) at org.apache.lucene
Re: [PR] [Unit] Increase Dynamic Range Faceting coverage and address edge cases [lucene]
gsmiller merged PR #14258: URL: https://github.com/apache/lucene/pull/14258 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
Re: [I] TestSsDvMultiRangeQuery.testDuelWithStandardDisjunction fails [lucene]
benwtrent commented on issue #14260: URL: https://github.com/apache/lucene/issues/14260#issuecomment-2669697888 Some additional seeds: > java.lang.AssertionError: expected:<1003+ hits> but was:<1001+ hits> ``` ./gradlew :lucene:sandbox:test --tests "org.apache.lucene.sandbox.search.TestSsDvMultiRangeQuery.testDuelWithStandardDisjunction" -Ptests.jvms=12 -Ptests.jvmargs= -Ptests.seed=99B3647F731B035E -Ptests.useSecurityManager=true -Ptests.nightly=true -Ptests.gui=true -Ptests.file.encoding=US-ASCII -Ptests.vectorsize=512 -Ptests.forceintegervectors=true ``` > java.lang.AssertionError: expected:<1002+ hits> but was:<1001+ hits> ``` gradlew :lucene:sandbox:test --tests "org.apache.lucene.sandbox.search.TestSsDvMultiRangeQuery.testDuelWithStandardDisjunction" -Ptests.jvms=12 -Ptests.jvmargs= -Ptests.seed=671F5F892B420491 -Ptests.useSecurityManager=true -Ptests.nightly=true -Ptests.gui=true -Ptests.file.encoding=UTF-8 -Ptests.vectorsize=512 -Ptests.forceintegervectors=true ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
[I] TestSsDvMultiRangeQuery.testDuelWithStandardDisjunction fails [lucene]
benwtrent opened a new issue, #14260: URL: https://github.com/apache/lucene/issues/14260 ### Description ``` TestSsDvMultiRangeQuery > testDuelWithStandardDisjunction FAILED java.lang.AssertionError: expected:<1002+ hits> but was:<1001+ hits> at __randomizedtesting.SeedInfo.seed([5ECF78EE8ABF1FBA:DCCCA12D922C2A7E]:0) at junit@4.13.1/org.junit.Assert.fail(Assert.java:89) at junit@4.13.1/org.junit.Assert.failNotEquals(Assert.java:835) at junit@4.13.1/org.junit.Assert.assertEquals(Assert.java:120) at junit@4.13.1/org.junit.Assert.assertEquals(Assert.java:146) at org.apache.lucene.sandbox.search.TestSsDvMultiRangeQuery.testDuelWithStandardDisjunction(TestSsDvMultiRangeQuery.java:130) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at randomizedtesting.runner@2.8.1/com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1758) at randomizedtesting.runner@2.8.1/com.carrotsearch.randomizedtesting.RandomizedRunner$8.evaluate(RandomizedRunner.java:946) at randomizedtesting.runner@2.8.1/com.carrotsearch.randomizedtesting.RandomizedRunner$9.evaluate(RandomizedRunner.java:982) at randomizedtesting.runner@2.8.1/com.carrotsearch.randomizedtesting.RandomizedRunner$10.evaluate(RandomizedRunner.java:996) ``` This then causes some threads to leak and the class runner to fail: ``` TestSsDvMultiRangeQuery > classMethod FAILED com.carrotsearch.randomizedtesting.ThreadLeakError: 1 thread leaked from SUITE scope at org.apache.lucene.sandbox.search.TestSsDvMultiRangeQuery: 1) Thread[id=34, name=pool-1-thread-1, state=TIMED_WAITING, group=TGRP-TestSsDvMultiRangeQuery] at java.base/jdk.internal.misc.Unsafe.park(Native Method) at java.base/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:410) at java.base/java.util.concurrent.LinkedTransferQueue$DualNode.await(LinkedTransferQueue.java:452) at java.base/java.util.concurrent.SynchronousQueue$Transferer.xferLifo(SynchronousQueue.java:194) at java.base/java.util.concurrent.SynchronousQueue.xfer(SynchronousQueue.java:233) at java.base/java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:336) at java.base/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1069) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) at java.base/java.lang.Thread.run(Thread.java:1570) at __randomizedtesting.SeedInfo.seed([5ECF78EE8ABF1FBA]:0) ``` ### Gradle command to reproduce ``` ./gradlew test --tests TestSsDvMultiRangeQuery.testDuelWithStandardDisjunction -Dtests.seed=5ECF78EE8ABF1FBA -Dtests.nightly=true -Dtests.locale=cv-RU -Dtests.timezone=US/Aleutian -Dtests.asserts=true -Dtests.file.encoding=UTF-8 ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
Re: [PR] Accept nodes where score == Math.nextUp(results.minCompetitiveSimilarity()) after #14215 [lucene]
iverase merged PR #14249: URL: https://github.com/apache/lucene/pull/14249 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
Re: [I] TestTieredMergePolicy.testPartialMerge fails [lucene]
jpountz closed issue #14255: TestTieredMergePolicy.testPartialMerge fails URL: https://github.com/apache/lucene/issues/14255 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
Re: [I] TestTieredMergePolicy.testPartialMerge fails [lucene]
jpountz closed issue #14255: TestTieredMergePolicy.testPartialMerge fails URL: https://github.com/apache/lucene/issues/14255 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
Re: [PR] Stop asserting on the max number of merged segments in TestTieredMergePolicy#testPartialMerge. [lucene]
jpountz merged PR #14259: URL: https://github.com/apache/lucene/pull/14259 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
Re: [PR] Improve user-facing docs. [lucene]
jpountz merged PR #14251: URL: https://github.com/apache/lucene/pull/14251 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
[PR] Stop asserting on the max number of merged segments in TestTieredMergePolicy#testPartialMerge. [lucene]
jpountz opened a new pull request, #14259: URL: https://github.com/apache/lucene/pull/14259 This assertion isn't right as `TieredMergePolicy` has become more sophisticated with the introduction of `targetSearchConcurrency` and different merging rules for merges below the floor size. Closes #14255 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
Re: [PR] Move `CombinedFieldQuery` to the core module. [lucene]
jpountz commented on PR #14236: URL: https://github.com/apache/lucene/pull/14236#issuecomment-2667960241 Thanks for correcting the title @gsmiller. This doesn't look controversial to me and there haven't been objections, so I'm feeling free to merge. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
Re: [PR] Move `CombinedFieldQuery` to the core module. [lucene]
jpountz merged PR #14236: URL: https://github.com/apache/lucene/pull/14236 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
Re: [PR] SortedSet DV Multi Range query [lucene]
gsmiller merged PR #13974: URL: https://github.com/apache/lucene/pull/13974 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
Re: [PR] Move `CombinedFieldQuery` to the core module. [lucene]
gsmiller commented on PR #14236: URL: https://github.com/apache/lucene/pull/14236#issuecomment-2669347208 > Thanks for correcting the title @gsmiller. Ha, sorry couldn't help fixing the typo. I had this open to have a look then got busy with other stuff and never came back to it (wanted to dig in a bit more on `CombinedFieldQuery` since I'm unfamiliar with it, but agreed that moving it out of sandbox doesn't appear to be a concern) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org