Spaces:
Sleeping
Sleeping
| # src/analyzer/search/query.py | |
| """ | |
| DEPRECATED: This module has been consolidated into hybrid_index.py | |
| For migration, use: | |
| - HybridIndex -> load_index() from hybrid_index | |
| - index.search() -> search(index, query, k=5) | |
| - index.by_grant_id() -> search_by_grant_id(index, grant_id) | |
| """ | |
| import warnings | |
| warnings.warn( | |
| "query.py is deprecated. Use hybrid_index.py instead.", | |
| DeprecationWarning, | |
| stacklevel=2 | |
| ) | |
| # Keep old class as a thin wrapper for backward compatibility | |
| from .hybrid_index import load_index, search, search_by_grant_id | |
| class HybridIndex: | |
| """Deprecated wrapper. Use functions from hybrid_index directly.""" | |
| def __init__(self, path): | |
| warnings.warn("HybridIndex class is deprecated", DeprecationWarning) | |
| self._idx = load_index(str(path)) | |
| def search(self, query: str, limit: int = 5): | |
| results = search(self._idx, query, k=limit) | |
| return [doc for doc, score in results] | |
| def by_grant_id(self, gid: str): | |
| results = search_by_grant_id(self._idx, gid, k=10) | |
| return [doc for doc, score in results] | |