--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> -----Ursprüngliche Nachricht-----
> Von: mongod...@googlegroups.com
> [mailto:mongod...@googlegroups.com] Im Auftrag von kevin
> Gesendet: Freitag, 5. November 2010 02:28
> An: mongod...@googlegroups.com
> Betreff: Re: [mongodb-user] Re: pymongo text search / regexp help
>
> hi the example you gave is not working. can you tell how to
> do in pymongo?
> i have a document with name kevinC. i want to do a case
> insensitive search and it is not working.
>
> >>> x.find_one({'name':'/kevinc/i'})
> >>> x.find_one({'name':{'$regex':'/kevinc/i'}})
> >>> x.find_one({'name':'kevinC'})._id
> ObjectId('4cc08693b6ce0c502c16a71c')
> >>>
Some thing like this?
x.find_one({'solrText': re.compile('|'.join(words), re.IGNORECASE)}
Here is what we use in our backend for simple text search:
import re
def getSearchQuery(searchText):
# simply search or OR search for strings with spaces
query = {}
if searchText:
words = searchText.split()
query['text'] = re.compile('|'.join(words), re.IGNORECASE)
return query
But I do not recommend to use this as a search concept
if you expect heavy use of it. I guess this is not very fast.
Hope that helps
Regards
Roger Ineichen
> <mailto:mongodb-user%2Bunsu...@googlegroups.com>
> <mongodb-user%2Bunsubscribe@google groups.com>
>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/mongodb-user?hl=en.
>
>
> --
>
> You received this message because you are subscribed to
> the Google Groups "mongodb-user" group.
> To post to this group, send email to
> mongod...@googlegroups.com.
> To unsubscribe from this group, send email to
> mongodb-user...@googlegroups.com
> <mailto:mongodb-user%2Bunsu...@googlegroups.com> .