Skip to content

Commit

Permalink
feat(algolia): configure custom algolia ranking
Browse files Browse the repository at this point in the history
  • Loading branch information
gforsyth committed Jul 30, 2024
1 parent 49f05c3 commit bafb13d
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/algolia/configure-algolia.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from __future__ import annotations # noqa: INP001

import os

from algoliasearch.search_client import SearchClient

api_key = os.environ["ALGOLIA_WRITE_API_KEY"]
app_id = os.environ["ALGOLIA_APP_ID"]
index_name = os.environ["ALGOLIA_INDEX"]


def main():
client = SearchClient.create(app_id, api_key)
index = client.init_index(index_name)

# Core is a custom attribute set to denote whether a record is part
# of the base expression API, we sort descending so those methods
# show up first in search instead of backend-specific methods
override_default_settings = {
"ranking": [
"typo",
"words",
"desc(core)",
"filters",
"proximity",
"attribute",
"exact",
]
}

index.set_settings(override_default_settings)


if __name__ == "__main__":
main()
File renamed without changes.
File renamed without changes.
12 changes: 10 additions & 2 deletions .github/workflows/ibis-docs-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,23 @@ jobs:
- name: Create and Upload Base Index
run: |
python .github/workflows/upload-algolia.py
python .github/workflows/algolia/upload-algolia.py
env:
ALGOLIA_WRITE_API_KEY: ${{ secrets.ALGOLIA_WRITE_API_KEY }}
ALGOLIA_APP_ID: TNU9HG3L41
ALGOLIA_INDEX: prod_ibis

- name: Create and Upload API Records to index
run: |
python .github/workflows/upload-algolia-api.py
python .github/workflows/algolia/upload-algolia-api.py
env:
ALGOLIA_WRITE_API_KEY: ${{ secrets.ALGOLIA_WRITE_API_KEY }}
ALGOLIA_APP_ID: TNU9HG3L41
ALGOLIA_INDEX: prod_ibis

- name: Configure custom ranking on Algolia
run: |
python .github/workflows/algolia/configure-algolia-api.py
env:
ALGOLIA_WRITE_API_KEY: ${{ secrets.ALGOLIA_WRITE_API_KEY }}
ALGOLIA_APP_ID: TNU9HG3L41
Expand Down

0 comments on commit bafb13d

Please sign in to comment.