Skip to content
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

AO3-6669 Search for noncanonical tags for autocomplete via Elasticsearch #4717

Merged
merged 23 commits into from
Apr 7, 2024

Conversation

zz9pzza
Copy link
Contributor

@zz9pzza zz9pzza commented Jan 14, 2024

Pull Request Checklist

Issue

https://otwarchive.atlassian.net/browse/AO3-6669

Purpose

What does this PR do?

Testing Instructions

How can the Archive's QA team verify that this is working as you intended?

If you have a Jira account with access, please update or comment on the issue
with any new or missing testing instructions instead.

References

Are there other relevant issues/pull requests/mailing list discussions?

Credit

What name and pronouns should we use to credit you in the Archive of Our Own's Release Notes?

If you have a Jira account, please include the same name in the "Full name"
field on your Jira profile, so we can assign you the issues you're working on.

Please note that if you do not fill in this section, we will use your GitHub account name and
they/them pronouns.

@zz9pzza zz9pzza marked this pull request as draft January 14, 2024 22:34
@zz9pzza zz9pzza closed this Jan 14, 2024
@zz9pzza zz9pzza reopened this Jan 15, 2024
@sarken sarken changed the title search for noncanonical_tag for autocomplete via elasticsearch AO3-6669 search for noncanonical_tag for autocomplete via elasticsearch Jan 16, 2024
@zz9pzza zz9pzza marked this pull request as ready for review January 18, 2024 23:04
Copy link
Collaborator

@sarken sarken left a comment

Choose a reason for hiding this comment

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

Two minor style things I noticed!

@sarken sarken changed the title AO3-6669 search for noncanonical_tag for autocomplete via elasticsearch AO3-6669 Search for noncanonical tags for autocomplete via Elasticsearch Apr 7, 2024
.where(["canonical = 0 AND name LIKE ?",
'%' + search_param + '%']).limit(10).map(&:name))
one_tag = tag_class.find_by(canonical: false, name: params[:term])
# Is there a tag which is just right (this is really for testing)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you explain how this is just for testing? I see match is used in rendering the output so I am slightly confused.

Copy link
Member

Choose a reason for hiding this comment

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

@zz9pzza please correct me if I'm wrong, but this is hit in if a user types the whole tag into autocomplete without choosing one of the suggestions first. The tests definitely do that, but in theory a real user could as well (although that seems potentially unlikely)

Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is used where I think it's used (the Synonyms field on canonical tags' edit pages), there's actually a pretty good choice the wrangler will be entering the name of the exact tag they're looking for, fwiw!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The code will not find exact matches naturally, adding the check for the exact match match makes this use case work and the elasticsearch code finds good matches for the autocomplete.

@sarken sarken merged commit 077aefd into otwcode:master Apr 7, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants