Support for hybrid search

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Support hybrid search - combining text and knn. We want to support searching on both text AND/OR embeddings.

We should first do Add text field types (#524810 - closed) to support text fields, then allow searching on both text and/or embeddings.

Looks at how hybrid search is implemented for Advanced Search - Elasticsearch vs. OpenSearch (they are different).

For postgres, we will search over text fields and/or embeddings. Using something like ts_query is out of the scope of this issue IMO.

This will require:

  • Updating databases/concerns/elastic_processor.rb and databases/postgresql/processor.rb to process a node of type :text
    • .text() -> return results that match the text
    • .and(.filter, .text) -> return results that match both the filter and text, same for prefix
    • .or(.filter, .text) -> return results that match either the filter or text, same for prefix
    • .and(.text, .knn) -> return results that match both the text and limited knn results
    • .or(.text, .knn) -> return results that match either the text or limited knn results
  • Updating query.rb
  • Updating specs
  • Updating docs
Edited by 🤖 GitLab Bot 🤖