searchHybrid method
Hybrid search combining vector and keyword (BM25) search.
Uses Reciprocal Rank Fusion (RRF) to combine semantic and keyword results.
Implementation
Future<List<hybrid.HybridSearchResult>> searchHybrid(
String query, {
int topK = 10,
double vectorWeight = 0.2,
double bm25Weight = 0.8,
List<int>? sourceIds,
String? collectionId,
}) async {
final service = await _serviceForCollection(collectionId);
await _flushIndex(
collectionId: collectionId,
); // Ensure index is up-to-date before searching
return service.searchHybrid(
query,
topK: topK,
vectorWeight: vectorWeight,
bm25Weight: bm25Weight,
sourceIds: sourceIds,
);
}