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

How to fuzzy query #573

Open
honghui0929 opened this issue Aug 11, 2017 · 1 comment
Open

How to fuzzy query #573

honghui0929 opened this issue Aug 11, 2017 · 1 comment

Comments

@honghui0929
Copy link

Like sql:
select*from table where name like %tom%

@dfahlander
Copy link
Collaborator

dfahlander commented Aug 13, 2017

db.table.filter(row => /tom/i.test(row.name))

The query cannot utilize an index (and would not on an SQL db either) - a full table scan will be performed. However, if you want like tom% (prefix search), indexes can be utilized on an ordinary SQL db, and in Dexie, that would be

db.table.where('name').startsWithIgnoreCase('tom')

Full Text Search indexes are another story and can be used to fuzzy search as well. Possible with dexie but not out of the box. Need to store search words in a multiEntry index. See samples on docs page for that.

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

No branches or pull requests

2 participants