Skip to content

docs(synonyms): add synonym list to redirect searches with no results #10163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a place we would want to handle better routing of "unique" -> "distinct"? Or is that a docstring change in the distinct doc to increase the search relevance there?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a place to add that, so if someone searches unique the top hit would be distinct. I'll add that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, actually, let me test this because I want to see if this just adds distinct or if it eliminates the valid unique on Arrays

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awwwww yeaaahhhh

2024-09-18_12-20

"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()