Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Searching a value in a specific field in MongoDB Full Text Search

Tags:

(MongoDB Full Text Search)

Hello, I have put some fields in index and this is how I could search for a search_keyword.

BasicDBObject search = new BasicDBObject("$search", "search_keyword"); 
BasicDBObject textSearch = new BasicDBObject("$text", search);

DBCursor cursor = users.find(textSearch);

I don't want search_keyword to be searched in all the fields specified in the index. *Is there any method to specify search_keyword to be searched in specific fields from the index??*

If so, please give me some idea how to do it in Java.

Thank you.