-
Notifications
You must be signed in to change notification settings - Fork 75
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
refactor(collections): refactor collection search to match monorepo #7124
refactor(collections): refactor collection search to match monorepo #7124
Conversation
f1017cd
to
b8f7630
Compare
import apiClient from 'panoptes-client/lib/api-client'; | ||
|
||
// Tune this value to determine when a search term is long enough to use Panoptes full-text search. | ||
const MIN_SEARCH_LENGTH = 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Increasing this value might be a workaround for weird results when the search is 4 or 5 characters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating to add that this breaks collections search for Gravity Spy, where there are 2-character collection names.
83c865a
to
49b461e
Compare
49b461e
to
0f20654
Compare
0f20654
to
5a3bedc
Compare
Panoptes full-text search requires at least 4 characters in order to return results. If your search string is longer than 4 characters, `collectionSearch` passes it to the Panoptes full-text search API. Otherwise, it fetches as many collections as it can that include the search string in the collection name.
5a3bedc
to
4d38d04
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM! Confirmed issue then confirmed these changes locally do indeed improve collections search similar to zooniverse/front-end-monorepo/pull/4867 .
Since zooniverse#7124, collections search no longer finds short collection names for Gravity Spy.
Panoptes full-text search requires at least 3 characters in order to return results. If your search string is longer than 3 characters,
collectionsSearch
passes it to the Panoptes full-text search API. Otherwise, it fetches as many collections as it can then filters for collections that include the search string in the collection name.The Panoptes API returns odd results for search terms that are 4 or 5 characters (not whole words), but the API’s not something that can be fixed here.
Screen.Recording.2024-06-08.at.19.08.54.mov
Required Manual Testing
Review Checklist
npm ci
and app works as expected?Optional
ChangeListener
orPromiseRenderer
components with code that updates component state?