Skip to content

Commit

Permalink
web: tuning search engine ranking of endpoints
Browse files Browse the repository at this point in the history
Prioritize GWS hits over N cases.
Prioritize endpoint longname over their shortname, since the naming scheme for
shortname is inconsistent.
  • Loading branch information
vincent-octo committed Nov 18, 2024
1 parent 60955c6 commit 65de3e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions web/lib/risteys/search_engine.ex
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ defmodule Risteys.SearchEngine do

defp compute_costs_endpoint(endpoint, user_keywords) do
ordered_attributes = [
:name,
:icd10_codes,
:icd9_codes,
:longname,
:name,
:icd10_descriptions,
:icd9_descriptions
]
Expand All @@ -92,8 +92,8 @@ defmodule Risteys.SearchEngine do
# Costs by attribute:
cost_attribute,
# Features that don't depend on the user's keywords
cost_endpoint_n_cases(endpoint),
cost_endpoint_n_gws_hits(endpoint)
cost_endpoint_n_gws_hits(endpoint),
cost_endpoint_n_cases(endpoint)
]
}
end
Expand Down Expand Up @@ -167,9 +167,8 @@ defmodule Risteys.SearchEngine do
@cost_infinity

nn ->
scale_factor = 1_000
# Setting to negative to set lower cost for higher N cases
-div(nn, scale_factor)
-nn
end
end

Expand All @@ -179,7 +178,7 @@ defmodule Risteys.SearchEngine do
@cost_infinity

nn ->
nn
-div(nn, 10)
end
end

Expand Down
6 changes: 3 additions & 3 deletions web/lib/risteys_web/live/search_box.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@
<div role="row">
<div role="gridcell"></div>
<div class="endpoint-name" role="gridcell">Name</div>
<div class="endpoint-longname" role="gridcell">Long name</div>
<div class="endpoint-n-cases" role="gridcell">N&nbsp;Cases</div>
<div class="endpoint-longname" role="gridcell">Description</div>
<div class="endpoint-n-gws-hits" role="gridcell">N&nbsp;GWS hits</div>
<div class="endpoint-n-cases" role="gridcell">N&nbsp;Cases</div>
</div>
</div>
<div role="rowgroup">
Expand All @@ -98,8 +98,8 @@
</div>
<div class="endpoint-name font-mono" role="gridcell"><%= endpoint.name %></div>
<div class="endpoint-longname" role="gridcell"><%= endpoint.longname %></div>
<div class="endpoint-n-cases" role="gridcell"><%= endpoint.n_cases %></div>
<div class="endpoint-n-gws-hits" role="gridcell"><%= endpoint.n_gws_hits %></div>
<div class="endpoint-n-cases" role="gridcell"><%= endpoint.n_cases %></div>
</a>
<% end %>
</div>
Expand Down

0 comments on commit 65de3e6

Please sign in to comment.