Skip to content

Commit

Permalink
Feature: update agents search endpoint to add option to have a custom…
Browse files Browse the repository at this point in the history
… qf paramter (#90)

* fix agents search sensibility

* improve agents search endpoint to search only exact string or substring match

* make the agent search endpoint query filter configurable

---------

Co-authored-by: Syphax <[email protected]>
  • Loading branch information
Bilelkihal and syphax-bouazzouni authored Aug 1, 2024
1 parent 4534006 commit 014eb3d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions controllers/search_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down Expand Up @@ -153,11 +153,17 @@ 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(' ')
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"
Expand Down

0 comments on commit 014eb3d

Please sign in to comment.