Skip to content

Commit

Permalink
Remove code reference to reranking
Browse files Browse the repository at this point in the history
[Learning to rank is being removed since this change](#2905)
  • Loading branch information
sihugh committed May 14, 2024
1 parent df03877 commit c929da1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 46 deletions.
2 changes: 1 addition & 1 deletion lib/search/batch_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def run(searches_params)
es_responses = timed_msearch(payloads)["responses"]

searches_params.map.with_index do |search_params, i|
process_es_response(search_params, builders[i], payloads[i], es_responses[i], false)
process_es_response(search_params, builders[i], payloads[i], es_responses[i])
end
end

Expand Down
7 changes: 2 additions & 5 deletions lib/search/presenters/result_set_presenter.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Search
# Presents a combined set of results for a GOV.UK site search
class ResultSetPresenter
attr_reader :es_response, :presented_aggregates, :reranked, :search_params
attr_reader :es_response, :presented_aggregates, :search_params

# `registries` should be a map from registry names to registries,
# which gets passed to the ResultSetPresenter class. For example:
Expand All @@ -12,8 +12,7 @@ def initialize(search_params:,
registries: {},
presented_aggregates: {},
schema: nil,
query_payload: {},
reranked: false)
query_payload: {})

@es_response = es_response
@aggregates = es_response["aggregations"]
Expand All @@ -22,7 +21,6 @@ def initialize(search_params:,
@presented_aggregates = presented_aggregates
@schema = schema
@query_payload = query_payload
@reranked = reranked
end

def present
Expand All @@ -34,7 +32,6 @@ def present
suggested_queries:,
suggested_autocomplete:,
es_cluster: search_params.cluster.key,
reranked:,
}

if search_params.show_query?
Expand Down
5 changes: 2 additions & 3 deletions lib/search/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def run(search_params)

es_response = process_elasticsearch_errors { timed_raw_search(payload) }

process_es_response(search_params, builder, payload, es_response, false)
process_es_response(search_params, builder, payload, es_response)
end

private
Expand Down Expand Up @@ -80,7 +80,7 @@ def process_elasticsearch_errors
end
end

def process_es_response(search_params, builder, payload, es_response, reranked)
def process_es_response(search_params, builder, payload, es_response)
# Augment the response with the suggest result from a separate query.
if search_params.suggest_spelling?
es_response["suggest"] = run_spell_checks(search_params)
Expand All @@ -99,7 +99,6 @@ def process_es_response(search_params, builder, payload, es_response, reranked)
presented_aggregates:,
schema: index.schema,
query_payload: payload,
reranked:,
).present
end

Expand Down
37 changes: 0 additions & 37 deletions spec/unit/result_set_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,41 +214,4 @@ def search_presenter(options)
}]).to eq result["policy_areas"]
end
end

context "reranked results" do
before do
@results = {
"hits" => {
"hits" => [],
"total" => 0,
},
}
end

it "sets reranked: false" do
output = described_class.new(
search_params: Search::QueryParameters.new(
start: 0,
aggregate_name: :aggregates,
),
es_response: @results,
reranked: false,
).present

expect(output[:reranked]).to eq(false)
end

it "sets reranked: true" do
output = described_class.new(
search_params: Search::QueryParameters.new(
start: 0,
aggregate_name: :aggregates,
),
es_response: @results,
reranked: false,
).present

expect(output[:reranked]).to eq(false)
end
end
end

0 comments on commit c929da1

Please sign in to comment.