observablehq / feedback

Customer submitted bugs and feature requests
42 stars 3 forks source link

Search function in data table cells does not work reliably #577

Open galopin opened 1 year ago

galopin commented 1 year ago

Describe the bug

The search function in data table cells fails to find all records that do contain apostrophes () or straight single quotes (').

I've published a notebook entitled Color Names, based on a project initiated by David Aerne, which lists more or less 30,000 color names.

There are over 400 records containing apostrophes in the CSV source file. And when I search for this character in the data table cell, only 5 records are found (!?)

I've run another test in tinker mode with straight single quotes and the result is just as erroneous :-/

To Reproduce

Steps to reproduce the behavior:

  1. In the search field of the data table cell, enter
  2. Only 5 matches are found

Expected behavior

It should yield over 400 matches.

Additional context

I reproduced the issue on other devices with distinct operating systems (macOS, Windows, iOS, Android) and web browsers.

Also I'd like to point out that restoring all columns to visibility fails to remove the additional columns count info…

mootari commented 1 year ago

The search only matches the start of a word (but also erroneously excludes numbers like "7`"). To give an example, searching for "read" won't match "Bread". That being said, how the search phrase is tokenized seems to differ from Inputs.search() (which produces 410 results).

I recommend to add a filter to your data table cell if you want exact results:

Screenshot 2023-06-13 at 12 12 51
galopin commented 1 year ago

The search only matches the start of a word […]

Thank you for providing me with the key to understanding the search function and the tip about the filter function.

But you have to admit it's a bit counter-intuitive — e.g. that's not how the built-in search tool in web browsers works...

In any case, there is a discrepancy between built-in filter that does produce 413 rows and Inputs.search() which produces 410 results.

Go figure…

(BTW, Inputs.search() appears to superbly ignore the hash sign (#): 0 results!?)

galopin commented 1 year ago

I've modified the original bug report which, in retrospect, was a little misleading.