-
Type: New Feature
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Text Search
-
None
Text search integration
1. Syntax
// basic search
db.coll.find( {$text : {$search : "term"}} )
// language option
db.coll.find( {$text : {$search : "term", $language : "spanish" }} )
// integrated skip / limit
db.coll.find( {$text : {$search : "term"}} ).skip(10*(pageno-1)).limit(10)
// integrated sort
db.coll.find( {$text : {$search : "term"}} ).sort(
{ date : 1 })
// integrated projection
db.coll.find( {$text : {$search : "term"}},
{description : 1, _id : 0})
// integrated filter (explicit and)
db.coll.find( {$and : [ {$text : {$search : "term" }},
{name : /a.*/}] } )
// integrated filter (implicit and) GOOD-ERH
db.coll.find( { $text : {$search : "term" }, name : /a.*/ } )
// all features combined
db.coll.find( { $and :
[
{$text : {$search : "\"phrase terms\" \"and term\" -term",
$language : "spanish" }},
{ name : /a.*/ }
// filter
]
},
{ name : 1, description : 1, _id : 0 }
// projection
).sort(
{ date : 1 }).skip(10).limit(10)
- duplicates
-
SERVER-9063 Integrate text search into normal query system
- Closed