MongoDB and fulltext search part of the word -
i need find part of word, if search len shut find words there starting len.
i'm trying use fulltext search in mongodb , working when hit 100% words , not part of words.
have sombardy soluion me issue working?
sample code there working:
db.getcollection('product').find({ '$and' : [{ '$text': { '$search' : 'lenovo', // match word '$casesensitive' : false }, '$text': { '$search' : 'y50 b50 y700', // synonym prepared '$casesensitive' : false } }] })
sample code want same resualt:
db.getcollection('product').find({ '$and' : [{ '$text': { '$search' : 'len', '$casesensitive' : false }, '$text': { '$search' : 'y50 b50 y700', '$casesensitive' : false } }] })
thanks time, , hope can fulltext search in mongodb
if want full text search in mongo should go $regex using query be
db.product.find({name:{$regex:/len/i}})
for more can read documentation well. https://docs.mongodb.com/manual/reference/operator/query/regex/
Comments
Post a Comment