Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Text search problem

Hi,

Let's see if this help:
pre
code
{"fieldName":{"$regex":"wor","$options":"im"}}
/code
/pre

This link should be helpful: http://docs.mongodb.org/manual/refere...

bahar.wadia
Posts: 0
Joined: Wed Aug 07, 2013 2:05 am

Text search problem

Hello Igor,

This only works for the first word in the sentence. Meaning, in the example I described above it will not return any rows because 'world' is the second word.

Thanks

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Text search problem

Hello! Try pre{"fieldName": {"$regex": "\\bwor.*", "$options":"im"}}/pre

bahar.wadia
Posts: 0
Joined: Wed Aug 07, 2013 2:05 am

Text search problem

That works great. I was missing the extra \ .

I am assuming that since you use Mongodb, which is compatible with PCRE, one can use any PCRE directives. Am I correct in my assumption?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Text search problem

Yes, you're right.

bahar.wadia
Posts: 0
Joined: Wed Aug 07, 2013 2:05 am

Text search problem

Thank you and slight correction...

when passing a query parameter the correct format is:

{"fieldName": {"$regex": "\\\\bwor.*", "$options":"im"}}

Thanks

Joe7349603
Posts: 0
Joined: Tue Jan 27, 2015 11:08 pm

Text search problem

Thanks for sharing ended up using your solution...Works great! Cheers!

Adam Garbinski
Posts: 0
Joined: Sat Sep 28, 2013 5:33 pm

Text search problem

Glad it worked for you Joe! You welcome.

Return to “Issues”