Merge pull request #12476 from Phlogi/dev-hybrid-search

fix: Avoid secondary error when collection is empty in parallel hybrid search
This commit is contained in:
Timothy Jaeryang Baek 2025-04-05 02:10:29 -07:00 committed by GitHub
commit 0f310b3509
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -320,11 +320,9 @@ def query_collection_with_hybrid_search(
log.exception(f"Error when querying the collection with hybrid_search: {e}")
return None, e
tasks = [
(collection_name, query)
for collection_name in collection_names
for query in queries
]
# Prepare tasks for all collections and queries
# Avoid running any tasks for collections that failed to fetch data (have assigned None)
tasks = [(cn, q) for cn in collection_names if collection_results[cn] is not None for q in queries]
with ThreadPoolExecutor() as executor:
future_results = [executor.submit(process_query, cn, q) for cn, q in tasks]