mirror of
https://github.com/langchain-ai/langchain-postgres.git
synced 2026-07-16 01:33:18 -04:00
[Documentation] Indicate dense vs sparse search in HybridSearchConfig #80
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?
Originally created by @alberto-agudo on GitHub (Jul 4, 2025).
Originally assigned to: @dishaprakash on GitHub.
The current configuration of HybridSearch mentions primary_search and secondary_search:
https://github.com/langchain-ai/langchain-postgres/blob/18b1bcdb75ed152da717e3d624e1ed822d17d60f/langchain_postgres/v2/hybrid_search_config.py#L19-L22
Even if you'd think primary search is dense (embeddings-based) and secondary is sparse (keyword-based), there's no guarantee in the class definition that it works this way. There's no need to mention this in the actual function arguments, but I think it is necessary in the docstring.
I didn't realize the actual meaning of primary and secondary until I found the following lines when digging in the code:
https://github.com/langchain-ai/langchain-postgres/blob/18b1bcdb75ed152da717e3d624e1ed822d17d60f/langchain_postgres/v2/async_vectorstore.py#L669-L673
Due to the current lack of documentation, it would greatly help others with the current lack of documentation to just change these lines in the HybridSearchConfig definition.
@dishaprakash commented on GitHub (Aug 19, 2025):
@alberto-agudo Thank you for opening the issue! We have recently updated the documentation for Hybrid Search. For more information see the how-to guide.
@alberto-agudo commented on GitHub (Aug 26, 2025):
@dishaprakash Thanks for the new docs! They seem quite helpful. In any case, I think it would be worth adding a small comment to the how-to guide mentioning that primary=dense (embedding-based) and secondary=sparse (full-text based).
@dishaprakash commented on GitHub (Sep 17, 2025):
@alberto-agudo This has been resolved in https://github.com/langchain-ai/langchain-postgres/pull/251.
Thank you for the contribution! Closing this issue now.