Class TextQuery
java.lang.Object
org.springframework.data.mongodb.core.query.Query
org.springframework.data.mongodb.core.query.TextQuery
- All Implemented Interfaces:
ReadConcernAware, ReadPreferenceAware
-
Constructor Summary
ConstructorsConstructorDescriptionCreates newTextQueryinlanguage.Creates newTextQueryusing thelocales language.
For a full list of supported languages see the mongdodb reference manual for Text Search Languages.TextQuery(TextCriteria criteria) Creates newTextQueryfor givenTextCriteria. -
Method Summary
Modifier and TypeMethodDescriptionorg.bson.DocumentGet the fieldname used for scoringorg.bson.DocumentAdd field score holding the documents textScore to the returned fields.includeScore(String fieldname) Include text search document score in returned fields using the given fieldname.booleanisSorted()Returns true if theQueryhas a sort parameter.static TextQueryqueryText(TextCriteria criteria) Creates newTextQuerysearching for givenTextCriteria.voidsetScoreFieldName(String fieldName) Set the fieldname used for scoring.Add sorting by text score.Methods inherited from class Query
addCriteria, allowDiskUse, allowSecondaryReads, collation, comment, cursorBatchSize, diskUse, equals, exhaust, fields, getCollation, getCriteria, getHint, getKeyset, getLimit, getMeta, getQueryObject, getReadConcern, getReadPreference, getRestrictedTypes, getSkip, hashCode, hasKeyset, hasReadConcern, hasReadPreference, isLimited, isRestrictedTypeKey, limit, limit, maxTime, maxTimeMsec, noCursorTimeout, of, partialResults, query, querySettingsEquals, restrict, setMeta, skip, toString, with, with, with, with, with, withHint, withHint, withReadConcern, withReadPreference
-
Constructor Details
-
TextQuery
- Parameters:
wordsAndPhrases-- See Also:
-
TextQuery
Creates newTextQueryinlanguage.
For a full list of supported languages see the mongdodb reference manual for Text Search Languages.- Parameters:
wordsAndPhrases-language-- See Also:
-
TextQuery
Creates newTextQueryusing thelocales language.
For a full list of supported languages see the mongdodb reference manual for Text Search Languages.- Parameters:
wordsAndPhrases- must not be null.locale- can be null.
-
TextQuery
Creates newTextQueryfor givenTextCriteria.- Parameters:
criteria- must not be null.
-
-
Method Details
-
queryText
Creates newTextQuerysearching for givenTextCriteria.- Parameters:
criteria- must not be null.- Returns:
- new instance of
TextQuery.
-
sortByScore
-
includeScore
-
includeScore
-
setScoreFieldName
Set the fieldname used for scoring.- Parameters:
fieldName- must not be null.
-
getScoreFieldName
-
getFieldsObject
public org.bson.Document getFieldsObject()- Overrides:
getFieldsObjectin classQuery- Returns:
- the field
Document.
-
getSortObject
public org.bson.Document getSortObject()- Overrides:
getSortObjectin classQuery- Returns:
- the sort
Document.
-
isSorted
-