Skip to content

Commit

Permalink
docs(synonyms): add synonym list to redirect searches with no results (
Browse files Browse the repository at this point in the history
  • Loading branch information
gforsyth authored Sep 18, 2024
1 parent b39ec14 commit 78fd5c6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/algolia/configure-algolia-api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
index_name = os.environ["ALGOLIA_INDEX"]


ONE_WAY_SYNONYMS = {
# A list of search terms that have (historically) not returned results
# that we can map to existing search terms that we know are good
"md5": ["hashbytes"],
"fetchdf": ["to_pandas", "to_polars", "to_pyarrow"],
"unique": ["distinct"],
}


def main():
client = SearchClient.create(app_id, api_key)
index = client.init_index(index_name)
Expand All @@ -30,6 +39,16 @@ def main():

index.set_settings(override_default_settings)

for input_, synonyms in ONE_WAY_SYNONYMS.items():
index.save_synonym(
{
"objectID": input_,
"type": "oneWaySynonym",
"input": input_,
"synonyms": synonyms,
}
)


if __name__ == "__main__":
main()

0 comments on commit 78fd5c6

Please sign in to comment.