Skip to content

Implement QueryWithIterator/SearchWithIterator#115

Draft
verdie-g wants to merge 4 commits intomilvus-io:mainfrom
verdie-g:search-with-iterator
Draft

Implement QueryWithIterator/SearchWithIterator#115
verdie-g wants to merge 4 commits intomilvus-io:mainfrom
verdie-g:search-with-iterator

Conversation

@verdie-g
Copy link
Contributor

@verdie-g verdie-g commented Nov 8, 2025

Closes #79

@verdie-g verdie-g marked this pull request as draft January 5, 2026 10:01
@yhmo
Copy link
Collaborator

yhmo commented Jan 19, 2026

@verdie-g
There is a conflict in this pr. Is it still in progress?

@verdie-g
Copy link
Contributor Author

verdie-g commented Jan 19, 2026

@yhmo there are few points I'm not sure about. For example, is the offset parameter a server-side parameter or it's a client-side hack? So it's ready to be reviewed. The conflicts should be easy to solve.

@yhmo
Copy link
Collaborator

yhmo commented Jan 20, 2026

@yhmo there are few points I'm not sure about. For example, is the offset parameter a server-side parameter or it's a client-side hack? So it's ready to be reviewed. The conflicts should be easy to solve.

SearchIterator doesn't support "offset" parameter.
QueryIterator can support "offset".

There is a seek() method to handle offset parameter:
In Java SDK: https://github.com/milvus-io/milvus-sdk-java/blob/303d8fe914ecde05d001e0f39d463ed13c74c9a8/sdk-core/src/main/java/io/milvus/orm/iterator/QueryIterator.java#L111
In CPP SDK: https://github.com/milvus-io/milvus-sdk-cpp/blob/64b2a5a5c97e7e04bb5732caf88f90a69b049bcc/src/impl/types/QueryIteratorImpl.cpp#L146

There is a limitation in milvus, query() interface returns no more than 16384 entities to client. Results of query() are ordered by primary keys.
If offset <= 16384, the seek() method calls query(limit=offset_value), the results are discarded, the last primary key value is recorded as the "current cursor position". The next() method will return results from this cursor position.
If offset > 16384, the seek() method will call query() for several times until the current cursor position is recorded.

It is much like a client-side hack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support iterator-based search

2 participants