zooniverse / front-end-monorepo

A rebuild of the front-end for zooniverse.org
https://www.zooniverse.org
Apache License 2.0
104 stars 30 forks source link

Inconsistent search for collections behavior #6120

Open goplayoutside3 opened 3 months ago

goplayoutside3 commented 3 months ago

Package

Choose from the list:

Describe the bug

The 'search for collections' feature is intended to return a list of a user's collections where the collection name matches the search text-input.

The search behavior is inconsistent and originally reported in this PFE Issue: https://github.com/zooniverse/Panoptes-Front-End/issues/7121

When adding a subject into an existing collection from the classification interface of a new frontend project, the search gives nice results - I get all three birds collections displayed immediately after typing 'bir'. Sadly, there seems to be a bug - if I type one more character ('bird'), it displays all my collections (Corpses, WOW, COOL, etc.) instead of just the three that actually include 'Birds' in their name. And after typing another one more character 'birds' it gives me the 'No matches found' result.

To Reproduce

In the video below my account has six collections. Three have the word 'birds' in the name:

  1. Birds One
  2. Birds Two
  3. Third named birds

When I search three letters 'bir', all three collections appear. However, when I search with four letters 'bird', all six of my collections appear regardless if bird is in the name. When I type five letters 'birds', only the first two collections with birds in the name appear. When I type a space after the five letters 'birds ', the list of collections is filtered to the three with 'birds' in the name.

This behavior is unexpected and buggy. Users should be able to type a string of text into the search field and see list of their collections where the name of the collection matches the string of text.

Screenshots

https://github.com/zooniverse/front-end-monorepo/assets/23665803/17a8ff9e-522c-494f-a901-5199afff9c08

Additional Info

Collections search last edited in https://github.com/zooniverse/front-end-monorepo/pull/4867

Link to CollectionsModal search field in the codebase.

CollectionsModal Storybook

goplayoutside3 commented 3 months ago

@yshish I've copied your original collections search bug report here. Thanks again!

eatyourgreens commented 3 months ago

However, when I search with four letters 'bird', all six of my collections appear regardless if bird is in the name.

I just realised that this is a really simple bug in my original collections search code. The text box isn’t waiting for search results to be fetched from Panoptes. #6127 fixes it.

eatyourgreens commented 3 months ago

When I type five letters 'birds', only the first two collections with birds in the name appear. When I type a space after the five letters 'birds ', the list of collections is filtered to the three with 'birds' in the name.

With five characters or more, you should be seeing whichever collections are sent back by the collections search here: https://github.com/zooniverse/panoptes/blob/6b7c85ee3b8191d3dbfd568409fc27fb2fcc3faf/app/models/collection.rb#L23-L26

My own experience is that the Panoptes full-text search doesn't always match what you'd expect for short search strings. That's also true for other full-text searches, such as searching projects by name, or Zooniverse users by login.