Page 1 of 1

Search with partial text Tiggzi DB

Posted: Sun Oct 21, 2012 11:05 pm
by Tommy B

I am creating an app that is similar to the one recently posted on your blog. My question is that I need to search with partial text. I have a column in the db that is named "INDUSTRY" and it contains string values such as

Agriculture
Construction of buildings
Steel frame construction
Farming

I want to search for the word construction and have it return the two records that have construction in them.

I have tried using {"INDUSTRY": {"$in": ["Construction"]}} in my where clause but it does not work.


Search with partial text Tiggzi DB

Posted: Sun Oct 21, 2012 11:20 pm
by maxkatz

code
{"States":{"$regex":"C", "$options":"i"}}
/code

above will search for all text that starts with C or c ($options: i -- ignores the case).


Search with partial text Tiggzi DB

Posted: Sun Oct 21, 2012 11:20 pm
by Tommy B

Got it:

I used this,

{"INDUSTRY":{"$regex":"construction","$options":"im"}}

I found it on pharse.com


Search with partial text Tiggzi DB

Posted: Sun Oct 21, 2012 11:21 pm
by Tommy B

Got it:

I used this,

{"INDUSTRY":{"$regex":"construction","$options":"im"}}

I found it on pharse.com