java.lang.Object
org.springframework.data.mongodb.core.query.Query
org.springframework.data.mongodb.core.query.TextQuery
All Implemented Interfaces:
ReadConcernAware, ReadPreferenceAware

public class TextQuery extends Query
Query implementation to be used to for performing full text searches.
Since:
1.6
Author:
Christoph Strobl, Mark Paluch
  • Constructor Details

  • Method Details

    • queryText

      public static TextQuery queryText(TextCriteria criteria)
      Creates new TextQuery searching for given TextCriteria.
      Parameters:
      criteria - must not be null.
      Returns:
      new instance of TextQuery.
    • sortByScore

      public TextQuery sortByScore()
      Add sorting by text score. Will also add text score to returned fields.
      Returns:
      this.
      See Also:
    • includeScore

      public TextQuery includeScore()
      Add field score holding the documents textScore to the returned fields.
      Returns:
      this.
    • includeScore

      public TextQuery includeScore(String fieldname)
      Include text search document score in returned fields using the given fieldname.
      Parameters:
      fieldname - must not be null.
      Returns:
      this.
    • setScoreFieldName

      public void setScoreFieldName(String fieldName)
      Set the fieldname used for scoring.
      Parameters:
      fieldName - must not be null.
    • getScoreFieldName

      public String getScoreFieldName()
      Get the fieldname used for scoring
      Returns:
      never null.
    • getFieldsObject

      public org.bson.Document getFieldsObject()
      Overrides:
      getFieldsObject in class Query
      Returns:
      the field Document.
    • getSortObject

      public org.bson.Document getSortObject()
      Overrides:
      getSortObject in class Query
      Returns:
      the sort Document.
    • isSorted

      public boolean isSorted()
      Description copied from class: Query
      Returns true if the Query has a sort parameter.
      Overrides:
      isSorted in class Query
      Returns:
      true if sorted.
      See Also: