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

Regular Expression Operator #27

Closed
mandolyte opened this issue Oct 19, 2013 · 9 comments
Closed

Regular Expression Operator #27

mandolyte opened this issue Oct 19, 2013 · 9 comments
Assignees

Comments

@mandolyte
Copy link

I'm new to document databases and I wondered whether regular expression support would be useful. You could always do this on the client side, but a large result set could be slow (large amount of data being returned to client over network connection).

If the regex was implemented on the server side, wouldn't that be more efficient?

I'm enjoying tiedot, thanks!

@HouzuoGuo
Copy link
Owner

Hello!

I am very glad to hear that you like tiedot.

Did you mean using regular expression to filter certain attribute in query result? For example, matching /(good)|(average)/ in document's "grade".

@mandolyte
Copy link
Author

Yes, or more complex: /[AF]/ in document's "grade". The high and low performers. Or again, to do wildcard searching,such as

  • all names ending in the letter "n": /n$/
  • all codes beginning with a letter and ending in a digit: /^[0-9].*[A-Z]$/

Since Go has a regexp package (http://golang.org/pkg/regexp/), I thought it would be pretty easy and would be nice addition the current eq, range, and set operations. In SQL I use wildcards a lot and noticed the absence in tiedot right away.

@HouzuoGuo
Copy link
Owner

Oh! I see.

In that case, I am afraid that index scan cannot help much at this stage, regex filter can be applied in collection scan (which is still quite fast).

@ghost ghost assigned HouzuoGuo Oct 21, 2013
@mandolyte
Copy link
Author

So would it look something like this?

q='{"re": "Go|Clojure", "in": ["Title"]}'

to find every title with either "Go" or "Clojure" in the title.

Thanks for considering,
Cecil

@HouzuoGuo
Copy link
Owner

That sounds like a great idea, let's do it.

@HouzuoGuo
Copy link
Owner

Fixed in d76e5aa thanks to NoahShen

@mandolyte
Copy link
Author

Great! Don't forget to update the docs to show how to use it!

On Thu, Nov 7, 2013 at 1:47 AM, Howard Guo notifications@github.com wrote:

Fixed in d76e5aahttps://github.com/HouzuoGuo/tiedot/commit/d76e5aa969b2e3cfb0a98cce9b77c077345741c9thanks to NoahShen


Reply to this email directly or view it on GitHubhttps://github.com//issues/27#issuecomment-27941459
.

@HouzuoGuo
Copy link
Owner

will do

@HouzuoGuo HouzuoGuo reopened this Nov 7, 2013
@HouzuoGuo
Copy link
Owner

Completed 9a5026a

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

2 participants