canjs / can-query-logic

Perform data queries and compare queries against each other. Provides logic useful for data caching and real-time behavior.

Home Page:https://canjs.com/doc/can-query-logic.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support for $text and $regex operators

dbleier opened this issue · comments

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.

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

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.

@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]
})