Performance: Hybrid search (keyword + semantic)
This concept impacts query response time and user experience by combining keyword and semantic search methods, affecting how fast and relevant results appear.
def hybrid_search(query): keyword_results = keyword_search(query, limit=10) semantic_results = semantic_search(query, limit=10) combined = merge_and_rank(keyword_results, semantic_results) return combined
def hybrid_search(query): keyword_results = keyword_search(query) semantic_results = semantic_search(query) combined = keyword_results + semantic_results return combined
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Sequential full keyword + semantic search | N/A (server-side) | N/A | N/A | [X] Bad |
| Limited parallel keyword + semantic search with merging | N/A (server-side) | N/A | N/A | [OK] Good |
results?
hybrid_search = HybridSearch(keyword_searcher, semantic_searcher)
results = hybrid_search.search('apple')hybrid_search = HybridSearch(keyword_searcher semantic_searcher)
results = hybrid_search.search('banana') What is the error and how to fix it?Pass the test and this pattern moves unknown