mirror of
https://github.com/langchain-ai/langchain-postgres.git
synced 2026-07-16 01:33:18 -04:00
[PR #257] [MERGED] fix: Fix hybrid search bugs #264
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/langchain-ai/langchain-postgres/pull/257
Author: @dishaprakash
Created: 10/7/2025
Status: ✅ Merged
Merged: 10/9/2025
Merged by: @averikitsch
Base:
main← Head:bug-fix📝 Commits (6)
0505073fix: Fix hybrid search bugs71cf9ffUpdate async_vectorstore.py7c108a0Update async_vectorstore.pycc1a7a9Merge branch 'main' into bug-fix661774cMerge branch 'main' into bug-fixc8c9727Update async_vectorstore.py📊 Changes
1 file changed (+13 additions, -16 deletions)
View changed files
📝
langchain_postgres/v2/async_vectorstore.py(+13 -16)📄 Description
This PR fixes the 2nd Major issue in https://github.com/langchain-ai/langchain-postgres/issues/234, related to Configuration and Querying Issues
Issue breakdown:
Inconsistent k Parameter: For hybrid searches, the dense search LIMIT was tied to the final k parameter, while the sparse search used its own secondary_top_k.
Late Initialization of HybridSearchConfig: The HybridSearchConfig was initialized after the k parameter was calculated, which could lead to incorrect behavior if the config was passed dynamically via
kwargs.Overview of the changes:
The __query_collection method now uses a separate
dense_limitfor the dense search query.If HybridSearchConfig is active, dense_limit is set to primary_top_k. For dense-only searches, dense_limit defaults to the final k value, preserving the existing behavior.
The hybrid_search_config is now initialized at the beginning of
__query_collection, ensuring that anykwargsoverrides are handled beforekordense_limitare calculated.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.