From 407ca91e2ed82fc84a741a900b8957680ab5b72e Mon Sep 17 00:00:00 2001 From: Keith Lawrence Date: Mon, 26 Jun 2023 10:48:52 +0100 Subject: [PATCH] Add optional parameter that allows forcing LTR on on the licences path. --- app/lib/search/query_builder.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/lib/search/query_builder.rb b/app/lib/search/query_builder.rb index 25d33a58c..38ad624ed 100644 --- a/app/lib/search/query_builder.rb +++ b/app/lib/search/query_builder.rb @@ -243,7 +243,7 @@ def ab_query # We're using the ab test relevance:disable params here to turn off LTR for this # finder. It would probably be best in the long run to create a specific way of # doing this that uses a proper parameter, but we can't do that at the moment. - ab_params.merge!("relevance" => "disable") if licence_transaction_path? + ab_params.merge!("relevance" => "disable") if licence_transaction_path? && !force_ltr? ab_params.any? ? { "ab_tests" => ab_params.map { |k, v| "#{k}:#{v}" }.join(",") } : {} end @@ -260,5 +260,9 @@ def boost_fields_query def licence_transaction_path? finder_content_item.base_path == "/find-licences" end + + def force_ltr? + params["force-ltr"] == "true" + end end end