public class TextResult extends Object
text
command.
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 }
This class wraps a single entry from the results
array.
Constructor and Description |
---|
TextResult(DocumentAssignable document)
Creates a new Text.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object object) |
Document |
getDocument()
Returns the document.
|
Document |
getRawDocument()
Returns the un-processed result document.
|
double |
getScore()
Returns the score for the document.
|
int |
hashCode() |
public TextResult(DocumentAssignable document)
document
- The document containing the 'score' and 'obj' fields.AssertionError
- On the search term not being set.public boolean equals(Object object)
Overridden to compare equal to an equivalent text result.
public Document getDocument()
public Document getRawDocument()
public double getScore()
Copyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.