text
command was deprecated in the 2.6
version of MongoDB. Use the $text
query operator instead. This class will not be removed
until two releases after the MongoDB 2.6 release (e.g. 2.10 if
the releases are 2.8 and 2.10).@Deprecated public class Text extends Object
text
command to query a collection with
a text index
.
The result of a text
command is a document that looks like the
following:
> db.collection.runCommand( { "text": "collection" , search: "coffee magic" } ) { "queryDebugString" : "coffe|magic||||||", "language" : "english", "results" : [ { "score" : 2.25, "obj" : { "_id" : ObjectId("51376ab8602c316554cfe248"), "content" : "Coffee is full of magical powers." } }, { "score" : 0.625, "obj" : { "_id" : ObjectId("51376a80602c316554cfe246"), "content" : "Now is the time to drink all of the coffee." } } ], "stats" : { "nscanned" : 3, "nscannedObjects" : 0, "n" : 2, "nfound" : 2, "timeMicros" : 97 }, "ok" : 1 }
The TextResult
class wraps a single entry from the results
array.
Modifier and Type | Class and Description |
---|---|
static class |
Text.Builder
Deprecated.
Support for the
text command was deprecated in the
2.6 version of MongoDB. Use the
$text query operator
instead. This class will not be removed until two releases
after the MongoDB 2.6 release (e.g. 2.10 if the releases are
2.8 and 2.10). |
Modifier and Type | Field and Description |
---|---|
static Version |
REQUIRED_VERSION
Deprecated.
The first version of MongoDB to support the text command.
|
Modifier | Constructor and Description |
---|---|
protected |
Text(Text.Builder builder)
Deprecated.
Creates a new Text.
|
Modifier and Type | Method and Description |
---|---|
static Text.Builder |
builder()
Deprecated.
Creates a new builder for a
Text command. |
String |
getLanguage()
Deprecated.
Returns the language to use when stemming the search terms.
|
int |
getLimit()
Deprecated.
Returns the maximum number of document to return.
|
Document |
getQuery()
Deprecated.
Returns the query document to limit the final results.
|
ReadPreference |
getReadPreference()
Deprecated.
Returns the
ReadPreference specifying which servers may be used
to execute the Text command. |
Document |
getReturnFields()
Deprecated.
Returns the fields to return from the query.
|
String |
getSearchTerm()
Deprecated.
Returns the search terms.
|
public static final Version REQUIRED_VERSION
protected Text(Text.Builder builder)
builder
- The builder containing the state of the text command.IllegalArgumentException
- On the search term not being set.public static Text.Builder builder()
Text
command.Text
command.public String getLanguage()
public int getLimit()
public Document getQuery()
public ReadPreference getReadPreference()
ReadPreference
specifying which servers may be used
to execute the Text
command.
If null
then the MongoCollection
instance's
ReadPreference
will be used.
MongoCollection.getReadPreference()
public Document getReturnFields()
public String getSearchTerm()
Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.