Repository navigation
fix(langchain): refuse ef_search or search_quality combined with filter instead of raising TypeError (part of #2302) - #2461
Merged
cyberlife-coder merged 6 commits intoOct 25, 2026
Conversation
…er instead of raising TypeError (part of #2302) The binding's search_with_ef and search_with_quality take no filter argument, so VelesDBVectorStore passing filter= to them raised a TypeError from inside the integration. Refuse the combination with a ValueError naming it, and document the Raises on similarity_search_with_ef (ef_search defaults to 64 there, so any filter is refused), in the README and in the CHANGELOG. The comment claiming the quality preset yields to a filter was wrong: the binding exposes no filtered quality search and the core read gate drops the quality profile when a filter is present. The combination is refused rather than silently ignored. No public method reached it, so this guards internal callers. The fake collection now mirrors the real search_with_ef signature, and a new test module runs ef_search+filter, plain ef_search, plain filter and the quality cases against the real velesdb binding (importorskip). A filtered search that honours ef_search is not implemented here: it needs a core public API (search_with_filter_and_ef), run_dense in database/gated_search.rs to stop ignoring ef when a filter is present, the PyO3 binding, the .pyi stub and a parity test. #2302 stays open.
Up to standards ✅🟢 Issues
|
cyberlife-coder
enabled auto-merge (squash)
October 24, 2026 21:17
cyberlife-coder
deleted the
fix/langchain-ef-search-with-filter-refused
branch
October 25, 2026 00:12
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.
Description
Part of #2302 (this PR does not close it).
Supersedes #2451, which cannot merge as it stands (non-conforming branch prefix and commit author). The original change is kept and extended with the review findings. #2451 stays open for its owner to close.
VelesDBVectorStorepassedfilter=to the binding'ssearch_with_ef, which has no such argument, so the call raised aTypeErrorfrom inside the integration. It now raises aValueErrornaming the unsupported combination.Changes on top of #2451:
similarity_search_with_efdocumentsRaises: ValueError(docstring,integrations/langchain/README.md, CHANGELOG).ef_searchdefaults to 64 there, so any call that passes afilteris refused. It already failed with theTypeError; usesimilarity_search_with_filterfor a filtered search without anef_searchoverride._run_vector_search("search_with_quality does not support combined filter+quality in the core engine yet") is replaced. The binding exposes no filtered quality search:Collection.search_with_qualitytakes no filter,SearchOptionshas no quality field, andrun_denseincrates/velesdb-core/src/database/gated_search.rsdrops the quality profile when a filter is present (corehassearch_with_quality_and_bitmap, but the PyO3 binding does not expose it). Sincesearch_qualitywas silently dropped whenfilterwas given, that combination now raises the same explicitValueError. No public method reaches it today (similarity_search_with_scoretakes no filter), so this guards internal callers.ef_searchalongsidesearch_qualityis unchanged:ef_searchwins, as in the core read gate, and the comment now says so.tests/test_ef_search_filter_real_binding.py, guarded bypytest.importorskip("velesdb"), runs against the real binding:ValueErrorforef_search+filter, plainef_searchand plain filter still work, a test pinning that the binding'ssearch_with_ef/search_with_qualitystill have nofilterparameter (it fails the day that changes, so the refusal gets lifted), quality + filter refused, plain quality works.test_core_feature_parity.pynow mirrors the realsearch_with_efsignature (ef_search=128, keyword-onlyprincipal/tenant).Known limitation (why #2302 stays open)
A filtered search that honours
ef_searchis not implemented here. A real fix needs:search_with_filter_and_ef;run_denseincrates/velesdb-core/src/database/gated_search.rsto stop ignoringefwhen a filter is present;.pyistub;Observation (not changed here)
integrations/llamaindex/src/llamaindex_velesdb/search_ops.pyquery_with_efaccepts**kwargsdocumented as "reserved for future use", which silently swallows a mistakenfilter=. That is the same bug class (a parameter dropped without notice); llamaindex is left untouched.Type of Change
How Has This Been Tested?
Unit tests
Integration tests
pytest integrations/langchain/tests: 217 passed, 2 skipped, 1 failed. The failure istest_e2e_complete.py::TestAsRetrieverE2E::test_as_retriever(VectorStoreRetrieverhas noget_relevant_documentswith the installed langchain-core 1.7.0). It fails identically onorigin/develop(208 passed, 2 skipped, 1 failed), so it is unrelated.scripts/check-doc-contract.sh, the fivecheck-doc-freshness.pyguards (strict),check-version-sync.py,check-mcp-doc-contract.py,check-promise-contract.py,check-feature-claims.py,check-python.shandcheck-ai-attribution.py origin/develop..HEAD: all pass.Test Configuration:
Checklist