Tommy B
Posts: 0
Joined: Sat Sep 15, 2012 3:39 am

Search with partial text Tiggzi DB

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.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Search with partial text Tiggzi DB

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

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

Tommy B
Posts: 0
Joined: Sat Sep 15, 2012 3:39 am

Search with partial text Tiggzi DB

Got it:

I used this,

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

I found it on pharse.com

Tommy B
Posts: 0
Joined: Sat Sep 15, 2012 3:39 am

Search with partial text Tiggzi DB

Got it:

I used this,

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

I found it on pharse.com

Return to “Issues”