searchHybrid method

Future<List<HybridSearchResult>> searchHybrid(
  1. String query, {
  2. int topK = 10,
  3. double vectorWeight = 0.2,
  4. double bm25Weight = 0.8,
  5. List<int>? sourceIds,
  6. String? collectionId,
})

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,
  );
}