Skip to content

Add query for hybrid_similarity

Siddharth Dungarwal requested to merge 479776-add-knn-query-for-work-items into master

What does this MR do and why?

This MR add knn query for issues in work_item index.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
image image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Make sure you have elasticsearch enabled and then add issue embeddings.
  2. Apply the diff to enable the hybrid_work_item_search
diff --git a/ee/lib/search/elastic/work_item_query_builder.rb b/ee/lib/search/elastic/work_item_query_builder.rb
index d38a1f0bfb0d..53c6b024815f 100644
--- a/ee/lib/search/elastic/work_item_query_builder.rb
+++ b/ee/lib/search/elastic/work_item_query_builder.rb
@@ -70,6 +70,7 @@ def get_confidentiality_filter(query_hash:, options:)

       # rubocop: disable Gitlab/FeatureFlagWithoutActor -- global flags
       def hybrid_work_item_search?
+        return true
         return false unless options[:hybrid_similarity]
         return false unless options[:knn_boost]
         return false unless Feature.enabled?(:search_issues_hybrid_search)
  1. Go to http://127.0.0.1:3000/search?group_id=24&project_id=2&scope=issues&search=Ignore+the+security+of+the+encryption&hybrid_similarity=0.6&knn_boost=5
  2. Notice you get the results, you can tweak with similarity and boost to refine and tune the search results.

Related to #479776

Edited by Siddharth Dungarwal

Merge request reports

Loading