diff --git a/src/java/org/apache/cassandra/index/sai/disk/v1/IndexSearcher.java b/src/java/org/apache/cassandra/index/sai/disk/v1/IndexSearcher.java index 14b182c7ee56..16d14bdd8ac3 100644 --- a/src/java/org/apache/cassandra/index/sai/disk/v1/IndexSearcher.java +++ b/src/java/org/apache/cassandra/index/sai/disk/v1/IndexSearcher.java @@ -94,10 +94,9 @@ protected IndexSearcher(PrimaryKeyMap.Factory primaryKeyMapFactory, * @param keyRange key range specific in read command, used by ANN index * @param queryContext to track per sstable cache and per query metrics * @param defer create the iterator in a deferred state - * @param limit the initial num of rows to returned, used by ANN index. More rows may be requested if filtering throws away more than expected! * @return {@link KeyRangeIterator} that matches given expression */ - public abstract KeyRangeIterator search(Expression expression, AbstractBounds keyRange, QueryContext queryContext, boolean defer, int limit) throws IOException; + public abstract KeyRangeIterator search(Expression expression, AbstractBounds keyRange, QueryContext queryContext, boolean defer) throws IOException; /** * Order the rows by the given Orderer. Used for ORDER BY clause when diff --git a/src/java/org/apache/cassandra/index/sai/disk/v1/InvertedIndexSearcher.java b/src/java/org/apache/cassandra/index/sai/disk/v1/InvertedIndexSearcher.java index 8b7d14c42755..774ffd3f2dbf 100644 --- a/src/java/org/apache/cassandra/index/sai/disk/v1/InvertedIndexSearcher.java +++ b/src/java/org/apache/cassandra/index/sai/disk/v1/InvertedIndexSearcher.java @@ -120,7 +120,7 @@ public long indexFileCacheSize() } @SuppressWarnings("resource") - public KeyRangeIterator search(Expression exp, AbstractBounds keyRange, QueryContext context, boolean defer, int limit) throws IOException + public KeyRangeIterator search(Expression exp, AbstractBounds keyRange, QueryContext context, boolean defer) throws IOException { PostingList postingList = searchPosting(exp, context); return toPrimaryKeyIterator(postingList, context); diff --git a/src/java/org/apache/cassandra/index/sai/disk/v1/KDTreeIndexSearcher.java b/src/java/org/apache/cassandra/index/sai/disk/v1/KDTreeIndexSearcher.java index 8a2aa354bd47..5911f2351014 100644 --- a/src/java/org/apache/cassandra/index/sai/disk/v1/KDTreeIndexSearcher.java +++ b/src/java/org/apache/cassandra/index/sai/disk/v1/KDTreeIndexSearcher.java @@ -84,7 +84,7 @@ public long indexFileCacheSize() } @Override - public KeyRangeIterator search(Expression exp, AbstractBounds keyRange, QueryContext context, boolean defer, int limit) throws IOException + public KeyRangeIterator search(Expression exp, AbstractBounds keyRange, QueryContext context, boolean defer) throws IOException { PostingList postingList = searchPosting(exp, context); return toPrimaryKeyIterator(postingList, context); diff --git a/src/java/org/apache/cassandra/index/sai/disk/v1/Segment.java b/src/java/org/apache/cassandra/index/sai/disk/v1/Segment.java index 87fe0a998e5f..3d52c944d726 100644 --- a/src/java/org/apache/cassandra/index/sai/disk/v1/Segment.java +++ b/src/java/org/apache/cassandra/index/sai/disk/v1/Segment.java @@ -144,7 +144,7 @@ public long indexFileCacheSize() */ public KeyRangeIterator search(Expression expression, AbstractBounds keyRange, QueryContext context, boolean defer, int limit) throws IOException { - return index.search(expression, keyRange, context, defer, limit); + return index.search(expression, keyRange, context, defer); } /** diff --git a/src/java/org/apache/cassandra/index/sai/disk/v2/V2VectorIndexSearcher.java b/src/java/org/apache/cassandra/index/sai/disk/v2/V2VectorIndexSearcher.java index 09e80338753a..21771ac94e1f 100644 --- a/src/java/org/apache/cassandra/index/sai/disk/v2/V2VectorIndexSearcher.java +++ b/src/java/org/apache/cassandra/index/sai/disk/v2/V2VectorIndexSearcher.java @@ -133,13 +133,13 @@ public ProductQuantization getPQ() } @Override - public KeyRangeIterator search(Expression exp, AbstractBounds keyRange, QueryContext context, boolean defer, int limit) throws IOException + public KeyRangeIterator search(Expression exp, AbstractBounds keyRange, QueryContext context, boolean defer) throws IOException { - PostingList results = searchPosting(context, exp, keyRange, limit); + PostingList results = searchPosting(context, exp, keyRange); return toPrimaryKeyIterator(results, context); } - private PostingList searchPosting(QueryContext context, Expression exp, AbstractBounds keyRange, int limit) throws IOException + private PostingList searchPosting(QueryContext context, Expression exp, AbstractBounds keyRange) throws IOException { if (logger.isTraceEnabled()) logger.trace(indexContext.logMessage("Searching on expression '{}'..."), exp); diff --git a/test/unit/org/apache/cassandra/index/sai/disk/v1/InvertedIndexSearcherTest.java b/test/unit/org/apache/cassandra/index/sai/disk/v1/InvertedIndexSearcherTest.java index 47565eb28739..899c03a95ccc 100644 --- a/test/unit/org/apache/cassandra/index/sai/disk/v1/InvertedIndexSearcherTest.java +++ b/test/unit/org/apache/cassandra/index/sai/disk/v1/InvertedIndexSearcherTest.java @@ -106,7 +106,7 @@ private void doTestEqQueriesAgainstStringIndex(Version version) throws Exception for (int t = 0; t < numTerms; ++t) { try (KeyRangeIterator results = searcher.search(new Expression(indexContext) - .add(Operator.EQ, termsEnum.get(t).originalTermBytes), null, new QueryContext(), false, LIMIT)) + .add(Operator.EQ, termsEnum.get(t).originalTermBytes), null, new QueryContext(), false)) { assertTrue(results.hasNext()); @@ -121,7 +121,7 @@ private void doTestEqQueriesAgainstStringIndex(Version version) throws Exception } try (KeyRangeIterator results = searcher.search(new Expression(indexContext) - .add(Operator.EQ, termsEnum.get(t).originalTermBytes), null, new QueryContext(), false, LIMIT)) + .add(Operator.EQ, termsEnum.get(t).originalTermBytes), null, new QueryContext(), false)) { assertTrue(results.hasNext()); @@ -143,12 +143,12 @@ private void doTestEqQueriesAgainstStringIndex(Version version) throws Exception // try searching for terms that weren't indexed final String tooLongTerm = randomSimpleString(10, 12); KeyRangeIterator results = searcher.search(new Expression(indexContext) - .add(Operator.EQ, UTF8Type.instance.decompose(tooLongTerm)), null, new QueryContext(), false, LIMIT); + .add(Operator.EQ, UTF8Type.instance.decompose(tooLongTerm)), null, new QueryContext(), false); assertFalse(results.hasNext()); final String tooShortTerm = randomSimpleString(1, 2); results = searcher.search(new Expression(indexContext) - .add(Operator.EQ, UTF8Type.instance.decompose(tooShortTerm)), null, new QueryContext(), false, LIMIT); + .add(Operator.EQ, UTF8Type.instance.decompose(tooShortTerm)), null, new QueryContext(), false); assertFalse(results.hasNext()); } } @@ -162,7 +162,7 @@ public void testUnsupportedOperator() throws Exception try (IndexSearcher searcher = buildIndexAndOpenSearcher(numTerms, numPostings, termsEnum)) { searcher.search(new Expression(indexContext) - .add(Operator.NEQ, UTF8Type.instance.decompose("a")), null, new QueryContext(), false, LIMIT); + .add(Operator.NEQ, UTF8Type.instance.decompose("a")), null, new QueryContext(), false); fail("Expect IllegalArgumentException thrown, but didn't"); } diff --git a/test/unit/org/apache/cassandra/index/sai/disk/v1/KDTreeIndexSearcherTest.java b/test/unit/org/apache/cassandra/index/sai/disk/v1/KDTreeIndexSearcherTest.java index 8f34b9a808aa..65242e319a37 100644 --- a/test/unit/org/apache/cassandra/index/sai/disk/v1/KDTreeIndexSearcherTest.java +++ b/test/unit/org/apache/cassandra/index/sai/disk/v1/KDTreeIndexSearcherTest.java @@ -151,7 +151,7 @@ public void testUnsupportedOperator() throws Exception {{ operation = Op.NOT_EQ; lower = upper = new Bound(ShortType.instance.decompose((short) 0), Int32Type.instance, true); - }}, null, new QueryContext(), false, LIMIT); + }}, null, new QueryContext(), false); fail("Expect IllegalArgumentException thrown, but didn't"); } @@ -169,7 +169,7 @@ private void testEqQueries(final IndexSearcher indexSearcher, {{ operation = Op.EQ; lower = upper = new Bound(rawType.decompose(rawValueProducer.apply(EQ_TEST_LOWER_BOUND_INCLUSIVE)), encodedType, true); - }}, null, new QueryContext(), false, LIMIT)) + }}, null, new QueryContext(), false)) { assertTrue(results.hasNext()); @@ -180,7 +180,7 @@ private void testEqQueries(final IndexSearcher indexSearcher, {{ operation = Op.EQ; lower = upper = new Bound(rawType.decompose(rawValueProducer.apply(EQ_TEST_UPPER_BOUND_EXCLUSIVE)), encodedType, true); - }}, null, new QueryContext(), false, LIMIT)) + }}, null, new QueryContext(), false)) { assertFalse(results.hasNext()); indexSearcher.close(); @@ -206,7 +206,7 @@ private void testRangeQueries(final IndexSearcher indexSearch lower = new Bound(rawType.decompose(rawValueProducer.apply((short)2)), encodedType, false); upper = new Bound(rawType.decompose(rawValueProducer.apply((short)7)), encodedType, true); - }}, null, new QueryContext(), false, LIMIT)) + }}, null, new QueryContext(), false)) { assertTrue(results.hasNext()); @@ -218,7 +218,7 @@ private void testRangeQueries(final IndexSearcher indexSearch {{ operation = Op.RANGE; lower = new Bound(rawType.decompose(rawValueProducer.apply(RANGE_TEST_UPPER_BOUND_EXCLUSIVE)), encodedType, true); - }}, null, new QueryContext(), false, LIMIT)) + }}, null, new QueryContext(), false)) { assertFalse(results.hasNext()); } @@ -227,7 +227,7 @@ private void testRangeQueries(final IndexSearcher indexSearch {{ operation = Op.RANGE; upper = new Bound(rawType.decompose(rawValueProducer.apply(RANGE_TEST_LOWER_BOUND_INCLUSIVE)), encodedType, false); - }}, null, new QueryContext(), false, LIMIT)) + }}, null, new QueryContext(), false)) { assertFalse(results.hasNext()); indexSearcher.close();