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

Case-insensitive search using Contains #656

Open
danmarshall opened this issue Jan 24, 2025 · 3 comments
Open

Case-insensitive search using Contains #656

danmarshall opened this issue Jan 24, 2025 · 3 comments
Labels
enhancement New feature or request

Comments

@danmarshall
Copy link

Hello, looking at the page https://idl.uw.edu/mosaic/inputs/ I tried to do a name search via the inputs:

Image

I was expecting a search for gar to include the first result A Jesus Garcia. It does work for Gar.
I realize this is a feature (not a bug) but was hoping the clause

search({ label: "Name", as: query, from: "athletes", column: "name", type: "contains" })

might allow to express this capability, without having to add an all-lowercased duplicate column copy name_lowercase.

@jheer jheer added the enhancement New feature or request label Jan 24, 2025
@jheer
Copy link
Member

jheer commented Jan 24, 2025

Thanks @danmarshall. Many of the underlying DuckDB string methods that we call (contains, starts_with, ends_with) for these selections are case-sensitive. So we will need to add an option (at the level of the search widget and maybe also the generated selection clause) that causes Mosaic to wrap both the column and query string in lower(...) calls to enforce case insensitivity.

In the meantime, explicitly transforming the text to lowercase is the way to go.

@declann
Copy link

declann commented Jan 24, 2025

Checking this noticed theres an inconsistency in what gets selected in the table and what gets shown in the search dropdown,

e.g. search abba => 5 results in dropdown (case insensitive) and 2 in table (case sensitive)

Screencast.from.2025-01-24.20-47-40.webm

@jheer
Copy link
Member

jheer commented Jan 24, 2025

Checking this noticed theres an inconsistency in what gets selected in the table and what gets shown in the search dropdown

Yep, the autocomplete list is currently managed purely by whatever browser you're using. Ultimately we would like to have our own autocomplete widget here to get proper control. I'd be very happy to review a PR if someone has the time to implement this in the inputs package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants