-
Notifications
You must be signed in to change notification settings - Fork 29
Feature request: access to query_relevance_score #64
Copy link
Copy link
Open
Description
I'd like to be able to only show results with a relevance above a certain threshhold.
Since we're doing some query expansion, the results set contains a lot of fuzz - documents which are only vaguely relevant. From reading the API docs it seems that the HTTP response body does include the relevance score of each result, which sounds perfect for this situation. However, as far as I can tell from the documentation Tanker doesn't support it.
Example
results = Article.search_tank('keyword')
top_results = results.select { |a| a.relevance >= 2 }
Relevant API Section
The response body will contain a JSON map with these fields:
"matches": the total number of matches for the query
"facets": a map from category name to a values count map
"results": a list of objects with the "docid" field
query_relevance_score: query specific document relevance score
variable_<N>: variable value, from 0 to N
category_<NAME>: category value for the NAME document category / facet
"search_time": the time it took to search in seconds
Possible solutions
- Instead of returning an array of whichever model, return an array of
Resultwhich extends the model and adds a new field calledrelevance, which is fetched from the IndexTank response. - Just expose the raw JSON response when you call
results.index_tank_json, as a fallback for situations where Tanker doesn't cover all the API's functionality.
Let me know your thoughts, when I have some time I'd love to help work on this if you think it sounds sensible.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels