From 309813c8d0d3ebb2cdab43765cff303a1912062b Mon Sep 17 00:00:00 2001 From: Syphax bouazzouni Date: Fri, 8 Mar 2024 10:57:00 +0100 Subject: [PATCH 1/3] add detType tov search ontologies content search endpoint --- Gemfile.lock | 4 ++-- controllers/search_controller.rb | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 19eb4731..3d8b465e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -196,7 +196,7 @@ GEM google-cloud-errors (~> 1.0) google-cloud-env (2.1.1) faraday (>= 1.0, < 3.a) - google-cloud-errors (1.3.1) + google-cloud-errors (1.4.0) google-protobuf (3.25.3-x86_64-darwin) google-protobuf (3.25.3-x86_64-linux) googleapis-common-protos (1.5.0) @@ -463,4 +463,4 @@ DEPENDENCIES webmock (~> 3.19.1) BUNDLED WITH - 2.4.21 + 2.4.22 diff --git a/controllers/search_controller.rb b/controllers/search_controller.rb index 63c2226b..23078652 100644 --- a/controllers/search_controller.rb +++ b/controllers/search_controller.rb @@ -108,8 +108,7 @@ class SearchController < ApplicationController conn = SOLR::SolrConnector.new(Goo.search_conf, :ontology_data) - - resp = conn.search(query, fq: fq, qf: qf, + resp = conn.search(query, fq: fq, qf: qf, defType: "edismax", page: page, page_size: page_size) total_found = resp["response"]["numFound"] From 4e87904dde1576523ed2bcefbe667b46197ed01b Mon Sep 17 00:00:00 2001 From: Syphax bouazzouni Date: Tue, 19 Mar 2024 15:16:24 +0100 Subject: [PATCH 2/3] fix content ontology search pagination --- controllers/search_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/search_controller.rb b/controllers/search_controller.rb index 23078652..78dd1175 100644 --- a/controllers/search_controller.rb +++ b/controllers/search_controller.rb @@ -109,7 +109,7 @@ class SearchController < ApplicationController conn = SOLR::SolrConnector.new(Goo.search_conf, :ontology_data) resp = conn.search(query, fq: fq, qf: qf, defType: "edismax", - page: page, page_size: page_size) + start: (page - 1) * page_size, rows: page_size) total_found = resp["response"]["numFound"] docs = resp["response"]["docs"] From 70412459459a8df319039476cd47296de4c3d1e1 Mon Sep 17 00:00:00 2001 From: Syphax bouazzouni Date: Tue, 19 Mar 2024 15:16:41 +0100 Subject: [PATCH 3/3] add ontology search content types filter --- controllers/search_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/controllers/search_controller.rb b/controllers/search_controller.rb index 78dd1175..9a354f08 100644 --- a/controllers/search_controller.rb +++ b/controllers/search_controller.rb @@ -100,11 +100,13 @@ class SearchController < ApplicationController query = params[:query] || params[:q] page, page_size = page_params ontologies = params.fetch("ontologies", "").split(',') + types = params.fetch("types", "").split(',') qf = params.fetch("qf", "") fq = [] fq << ontologies.map { |x| "ontology_t:\"#{x}\"" }.join(' OR ') unless ontologies.blank? + fq << types.map { |x| "type_t:\"#{x}\" OR type_txt:\"#{x}\"" }.join(' OR ') unless types.blank? conn = SOLR::SolrConnector.new(Goo.search_conf, :ontology_data)