Skip to content

Conversation

@JHSeo-git
Copy link
Contributor

@JHSeo-git JHSeo-git commented Aug 12, 2025

See #238 for details.

Added code to expose the functions (aapply_hybrid_search_index, apply_hybrid_search_index) for adding an index to the tsv column in hybrid search.

I also fixed minor typos in the existing test code for better readability.

-DEFAULT_TABLE_ASYNC = "default_sync" ...
+DEFAULT_TABLE_ASYNC = "default_async" ...
  • langchain_postgres/v2/vectorstores.py: Added new index creation methods
  • tests/unit_tests/v2/test_pg_vectorstore_index.py: Added comprehensive test coverage
  • pyproject.toml: Updated test dependencies
  • tests/utils.py: Minor updates
  • DEVELOPMENT.md: Minor updates

It also includes changes to align test-related environment variable settings between DEVELOPMENT.md and utils.py.

For testing, I initially attempted to use the existing dependency psycopg, but on my current environment (not installed deps like libpq, MacBook Apple M4 Max), running with the existing dependency caused errors. To ensure compatibility across environments, I added psycopg[binary].

psycopg error
    import_from_libpq()
.venv/lib/python3.13/site-packages/psycopg/pq/__init__.py:108: in import_from_libpq
    raise ImportError(
E   ImportError: no pq wrapper available.
E   Attempts made:
E   - couldn't import psycopg 'c' implementation: No module named 'psycopg_c'

@dishaprakash
Copy link
Collaborator

@JHSeo-git Thank you opening this PR. Could you please add units tests similar to the ones that exist for the AsyncPGVectorStore shown here.

@JHSeo-git JHSeo-git force-pushed the add-apply-hybrid-search-index-in-vectorstore branch from c194523 to 49a79cc Compare August 14, 2025 00:31
- update postgres_db name for test in DEVELOPMENT.md
- update postgres_port for test in utils.py
- add psycopg[binary] for test using binary psycopg
@JHSeo-git
Copy link
Contributor Author

@dishaprakash Thanks for the feedback 😄! I’ve added unit tests similar to the existing AsyncPGVectorStore ones, along with a few related configuration updates. Let me know if there’s anything else you’d like to see covered.

- add tests for creating and validating hybrid search indexes using HybridSearchConfig
- add tests for applying hybrid search indexes to tables with and without TSV columns
- add tests for applying hybrid search indexes in both async and sync versions
- add hybrid table cleanup logic to existing tests
@JHSeo-git JHSeo-git force-pushed the add-apply-hybrid-search-index-in-vectorstore branch from eab90c1 to 702d6dd Compare August 14, 2025 03:17
@averikitsch averikitsch self-requested a review August 18, 2025 17:55
tests/utils.py Outdated
POSTGRES_DB = os.environ.get("POSTGRES_DB", "langchain_test")

POSTGRES_PORT = os.environ.get("POSTGRES_PORT", "5432")
POSTGRES_PORT = os.environ.get("POSTGRES_PORT", "6024")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done revert

@dishaprakash dishaprakash merged commit 683efd7 into langchain-ai:main Aug 20, 2025
2 checks passed
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.

3 participants