-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from alphagov/best-bets
Add simple ability to define best bets
- Loading branch information
Showing
5 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module DiscoveryEngine | ||
module BestBetsBoost | ||
def best_bets_boost_specs(query_string) | ||
best_bets_for_query = Array(Rails.configuration.best_bets[query_string]) | ||
return unless best_bets_for_query.any? | ||
|
||
condition_links = best_bets_for_query.map { "\"#{_1}\"" }.join(",") | ||
[{ | ||
boost: 1, | ||
condition: "link: ANY(#{condition_links})", | ||
}] | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
shared: | ||
# TODO: Test data that we can delete once demo'ed | ||
"i want to test best bets": | ||
- /government/people/test-person | ||
- /government/publications/test--150 | ||
- /service-manual/technology/test-your-services-performance | ||
|
||
test: | ||
"i want to test a single best bet": /here/you/go | ||
"i want to test multiple best bets": | ||
- /i-am-important | ||
- /i-am-also-important | ||
- /also-me |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters