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

support for $text and $regex operators #49

Open
dbleier opened this issue Jul 10, 2019 · 3 comments
Open

support for $text and $regex operators #49

dbleier opened this issue Jul 10, 2019 · 3 comments

Comments

@dbleier
Copy link

dbleier commented Jul 10, 2019

Right now it seems that you can only do exact string matches. It would be great to be able to do fuzzy and partial searching either with regular expressions or with a string.contains kind of search similar to $regex and $text in mongodb.

This will be especially helpful in query on can-fixture stores.

@justinbmeyer
Copy link
Contributor

The query logic docs show how to make something like this I think.

@dbleier
Copy link
Author

dbleier commented Jul 11, 2019

this? https://canjs.com/doc/can-query-logic.defineComparison.html#Use

I can try it. But it would still be great to have $regex and $text as part of the standard can package.

@justinbmeyer
Copy link
Contributor

@dbleier yes that. Though you'll have to make something like:

myProp: {$text: "abc"} work instead of:

myProp: "abc"

If this can't be figured out, I can probably show sometime this week, if not this week, when I'm back from PTO on Monday.

Regarding including it as part of the standard package ... I'm wary of including it in can-query-logic itself. We've been trying to slim down CanJS. However, putting it in an export that can be mixed in would be great:

import {QueryLogic, QueryLogicTextSearch} from "can";

new QueryLogic(schema, {
  operators: [QueryLogicTextSearch]
})

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

No branches or pull requests

3 participants