how to use regex in the wql. #103

Open
archiechen opened this Issue May 24, 2013 · 1 comment

Projects

None yet

2 participants

@archiechen

I defined a seach card,the content is {"name":["match","^[0-9]"]}.but not result be found.
I expect some cards that named "163" and "163web".

I watch the debug log,found "^[0-9]" convert to "0_9" in the sql.

sql as:
select t.name from cards t where t.key REGEXP '1_9' and t.trash is false ORDER BY t.updated_at desc LIMIT 20 OFFSET 0

code: line 515 of wql.rb
[v].flatten.map(&:to_name).map(&:key)]

@ethn
Collaborator
ethn commented May 24, 2013

Well, I'm impressed both that you're pushing WQL further than most and that you readily nailed the source of the problem. Looks like we need to refine that algorithm to make sure the key generation doesn't castrate the regexp.

The "match" processing is going to get more attention soon when we start looking more seriously into cross-platform fulltext support. But I see no reason why we shouldn't be able to put together a much narrower patch to fix this.

My dev computer is in the shop until early next week. I'll personally have a go at fixing then if nobody else does before that.

Thanks for the great sleuthing!

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