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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is the "$regex" search operator implemented ? #107

Closed
DataHearth opened this issue May 4, 2023 · 4 comments 路 Fixed by #114
Closed

Is the "$regex" search operator implemented ? #107

DataHearth opened this issue May 4, 2023 · 4 comments 路 Fixed by #114
Labels
enhancement New feature or request Low priority

Comments

@DataHearth
Copy link
Contributor

Hey !

I just started using PoloDB and it works like a charm ! Great software and it's very intuitive 馃槃 .

I have a quick question. The documentation specifies which search operator is implemented from the MongoDB engine (I guess it's the MongoDB engine). Does it includes the $regex operator ?

I want to search for a specific pattern inside the DB with a simple pattern like

{
"$regex": [{
  "name":  r".*name.*"g
}]

Thanks!

@vincentdchan
Copy link
Collaborator

Hi! This feature has not been implemented yet. However, if MongoDB implements it, I will add it to the roadmap. As I am currently working on implementing create_index, this will be considered a lower priority.

If you are interested, pull requests are also welcome.

@vincentdchan vincentdchan added enhancement New feature or request Low priority labels May 4, 2023
@DataHearth
Copy link
Contributor Author

@vincentdchan Hey! I started working on this feature on my free time ^^. But I'm quite lost with the codebase (firsttime with a big rust codebase ^^"). Do you know how I could debug the behavior of the evaluation on the $regex or any other query like evaluation ?

At first glance, it seems that the bson::bson::Regex is translated to plain text and not interpreted/evaluated for this case.

Thanks !

@vincentdchan
Copy link
Collaborator

Thanks for your interests! Implementing this is not a simple task, but I can provide you with some ideas.

  1. Recognize $regex semantics in polodb_core/vm/subprogram.rs. You can try to understand the test print_complex_print.
  2. Add an op to represents the regex tester in polodb_core/vm/op.rs
  3. Modify subprogram to compile your regex tester op.
  4. Implement the new OP in polodb_core/vm/vm.rs
  5. Add unit tests

Don't know if it would be too difficult for you. You can give it a try~

@DataHearth
Copy link
Contributor Author

Thanks the tips! I'll give it a try 馃槃.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Low priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants