Mongo Full text search (FTS) compound index?

127 views
Skip to first unread message

Kapil Israni

unread,
Jun 12, 2013, 4:53:18 AM6/12/13
to mongod...@googlegroups.com
** Is it possible to create a compound index with a full text search field in it, so something like that:

db.posts.ensureIndex( { user_id: 1, content: "text", hidden_flag: 1 } )


** More importantly, how do you run a Full text search query on this? I want to do text search on user's posts, so something like that:

db.posts.runCommand("text", { search: "cool stuff", filter: { user_id: ObjectId("518d3f6b89d50f8b65000005"), hidden_flag: "1" } } )


As I understand, filter does not use index. Is there a way to make mongo use the compound index?


** Also it it possible to do a explain on a full text query?


Sam Millman

unread,
Jun 12, 2013, 4:59:07 AM6/12/13
to mongod...@googlegroups.com
I do not believe FTS intresectioning with other indexes yet. This is normally the way to sovle this, you would intersect the fts index with the normal index to reduce your result set by user_id, however, I beleive this is not yet possible but it coming




--
--
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
See also the IRC channel -- freenode.net#mongodb
 
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages