-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
boosted_category_id
column and add to Algolia index. (#748)
This adds a `boosted_category_id` column to Services, which is a nullable foreign key to the Categories table. This is intended to be used by the frontend code through Algolia as a possible target of the optional filters feature of Algolia, allowing us to boost search rankings for specific services on specific pages. This column is added to the Algolia index as `boosted_category`, which holds the string name of the category, and we also add it to the `attributesForFaceting` list so that it can be used for optional filters. Finally, we change the Algolia index ranking order from its default by placing `geo` after `filters`. This is needed in order for optional filters to have higher precedence than geolocation.
- Loading branch information
1 parent
0296659
commit 3a9c0af
Showing
3 changed files
with
19 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
5 changes: 5 additions & 0 deletions
5
db/migrate/20240804222349_add_boosted_category_to_services.rb
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,5 @@ | ||
class AddBoostedCategoryToServices < ActiveRecord::Migration[6.1] | ||
def change | ||
add_reference :services, :boosted_category, foreign_key: { to_table: :categories } | ||
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