From 515bd0e4ae4f95b669212a2d0ac61bed58749fc1 Mon Sep 17 00:00:00 2001 From: Bilel KIHAL Date: Thu, 1 Aug 2024 00:27:32 +0200 Subject: [PATCH 1/3] fix agents search sensibility --- controllers/search_controller.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/controllers/search_controller.rb b/controllers/search_controller.rb index cf2d76c6..d25af600 100644 --- a/controllers/search_controller.rb +++ b/controllers/search_controller.rb @@ -63,7 +63,7 @@ class SearchController < ApplicationController page_size: page_size, sort: sort }) - + total_found = page_data.aggregate ontology_rank = LinkedData::Models::Ontology.rank docs = {} @@ -154,7 +154,6 @@ class SearchController < ApplicationController fq = "agentType_t:#{type}" if type qf = [ - "acronymSuggestEdge^25 nameSuggestEdge^15 emailSuggestEdge^15 identifiersSuggestEdge^10 ", # start of the word first "identifiers_texts^20 acronym_text^15 name_text^10 email_text^10 ", # full word match "acronymSuggestNgram^2 nameSuggestNgram^1.5 email_text^1" # substring match last ].join(' ') From a9c1e7b2319d0985f5b4dd9e3466587bf67a5fb3 Mon Sep 17 00:00:00 2001 From: Bilel KIHAL Date: Thu, 1 Aug 2024 10:36:29 +0200 Subject: [PATCH 2/3] improve agents search endpoint to search only exact string or substring match --- controllers/search_controller.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/controllers/search_controller.rb b/controllers/search_controller.rb index d25af600..5f474252 100644 --- a/controllers/search_controller.rb +++ b/controllers/search_controller.rb @@ -153,10 +153,7 @@ class SearchController < ApplicationController fq = "agentType_t:#{type}" if type - qf = [ - "identifiers_texts^20 acronym_text^15 name_text^10 email_text^10 ", # full word match - "acronymSuggestNgram^2 nameSuggestNgram^1.5 email_text^1" # substring match last - ].join(' ') + qf = "identifiers_texts^20 acronym_text^15 name_text^10 email_text^10" # full word match if params[:sort] sort = "#{params[:sort]} asc, score desc" From 0f48567b13f5f614abea03b9d5ee80e464f4effb Mon Sep 17 00:00:00 2001 From: Syphax Date: Thu, 1 Aug 2024 20:21:19 +0200 Subject: [PATCH 3/3] make the agent search endpoint query filter configurable --- controllers/search_controller.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/controllers/search_controller.rb b/controllers/search_controller.rb index 5f474252..ce34d51d 100644 --- a/controllers/search_controller.rb +++ b/controllers/search_controller.rb @@ -153,7 +153,17 @@ class SearchController < ApplicationController fq = "agentType_t:#{type}" if type - qf = "identifiers_texts^20 acronym_text^15 name_text^10 email_text^10" # full word match + if params[:qf] + qf = params[:qf] + else + qf = [ + "acronymSuggestEdge^25 nameSuggestEdge^15 emailSuggestEdge^15 identifiersSuggestEdge^10 ", # start of the word first + "identifiers_texts^20 acronym_text^15 name_text^10 email_text^10 ", # full word match + "acronymSuggestNgram^2 nameSuggestNgram^1.5 email_text^1" # substring match last + ].join(' ') + end + + if params[:sort] sort = "#{params[:sort]} asc, score desc"