[query] Support SQLite's LIKE for non-fulltext text searching
#747 ouverte le 18 juin 2018
Métriques du dépôt
- Stars
- (1 661 stars)
- Métriques de merge PR
- (Métriques PR en attente)
Description
While implementing a rough clone of Firefox for iOS's logins handling, I noticed that we don't support SQLite's LIKE operator for non-fulltext text searching. That's what we use in Firefox for iOS, and I don't want to make some of these fields :db/fulltext true, so we should grow support for it. I'm thinking that it'll be a special filtering function, like:
[:find ?e :where
[?e :credential/name ?t]
[(string-contains ?t "pattern")]]
although there are a few subtleties. First, "pattern" can be a binding (which is well supported by SQLite). Second, the pattern can contain _ and %, which have special meaning to SQLite. It's easy to escape a constant pattern, but not so easy to escape a binding (coming from elsewhere in the query engine, i.e., another column). We could make escaping the responsibility of the consumer, but that's likely to lead to surprises.
As a first cut, we could only accept literal patterns, which we can escape (or not) and transform concretely.