HNSW streaming KNN search support#138
Open
maximbogatyrev wants to merge 1 commit into
Open
Conversation
MadSchemas
reviewed
Jul 10, 2026
| throw new IllegalArgumentException("Minimal value of 'ef' must be greater than or equal to 'k'"); | ||
| } | ||
| } else if (ef <= 0) { | ||
| throw new IllegalArgumentException("Minimal value of 'ef' must be greater than 0"); |
Contributor
There was a problem hiding this comment.
А откуда появилось вот это ограничение? Насколько я помню, в ядро для стриминг-режима можно передать ef=0 и там пройдёт выборка
Author
There was a problem hiding this comment.
Ну, вообще вроде не должны проходить валидацию на этапе разбора knn-параметров (ни через десериализацию, ни через c++ query-builder):
void KnnSearchParams::Validate() const {
// Empty 'k' and empty 'radius' both are allowed for the streaming KNN search over an HNSW index
std::visit(
overloaded{[](const KnnSearchParamsBase& p) { checkKNotZero(p); }, [](const BruteForceSearchParams& p) { checkKandRadius(p); },
[](const HnswSearchParams& p) {
checkKNotZero(p);
if (p.K() && p.Ef() < *p.K()) {
throw Error{errQueryExec, "Ef should not be less than k in hnsw query"};
}
if (p.Ef() < 1) {
throw Error{errQueryExec, "Value of 'ef' - {} is out of bounds: [1,{}]", p.Ef(),
std::numeric_limits<size_t>::max()};
}
},
[](const IvfSearchParams& p) {
checkKandRadius(p);
if (p.NProbe() == 0) {
throw Error{errQueryExec, "Nprobe should not be 0"};
}
}},
toVariant());
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Добавлена поддержка HNSW streaming KNN — поиск без обязательных
kиradiusв базовых параметрах, с пагинацией через limit/offset на запросе. Соответствует доработке в основном reindexer-репозитории.BaseKnnSearchParamпри сериализации HNSW-параметров (allowEmpty)KnnParams.base()дляstreaming-режимаef> 0BF/IVFпо-прежнему требуется хотя бы один изkилиradiusk, streaming сlimit/offset, проверкаrankиpost-filter)API