Class TextCriteria

java.lang.Object
org.springframework.data.mongodb.core.query.TextCriteria
All Implemented Interfaces:
CriteriaDefinition

public class TextCriteria extends Object implements CriteriaDefinition
Implementation of CriteriaDefinition to be used for full text search.
Since:
1.6
Author:
Christoph Strobl, Oliver Gierke, Mark Paluch
  • Constructor Details

  • Method Details

    • forDefaultLanguage

      public static TextCriteria forDefaultLanguage()
      Returns a new TextCriteria for the default language.
      Returns:
    • forLanguage

      public static TextCriteria forLanguage(String language)
      For a full list of supported languages see the mongodb reference manual for Text Search Languages.
      Parameters:
      language -
      Returns:
    • matchingAny

      public TextCriteria matchingAny(String... words)
      Configures the TextCriteria to match any of the given words.
      Parameters:
      words - the words to match.
      Returns:
    • matching

      public TextCriteria matching(Term term)
      Adds given Term to criteria.
      Parameters:
      term - must not be null.
    • matching

      public TextCriteria matching(String term)
      Parameters:
      term -
      Returns:
    • notMatching

      public TextCriteria notMatching(String term)
      Parameters:
      term -
      Returns:
    • notMatchingAny

      public TextCriteria notMatchingAny(String... words)
      Parameters:
      words -
      Returns:
    • notMatchingPhrase

      public TextCriteria notMatchingPhrase(String phrase)
      Given value will treated as a single phrase.
      Parameters:
      phrase -
      Returns:
    • matchingPhrase

      public TextCriteria matchingPhrase(String phrase)
      Given value will treated as a single phrase.
      Parameters:
      phrase -
      Returns:
    • caseSensitive

      public TextCriteria caseSensitive(boolean caseSensitive)
      Optionally enable or disable case sensitive search.
      Parameters:
      caseSensitive - boolean flag to enable/disable.
      Returns:
      never null.
      Since:
      1.10
    • diacriticSensitive

      public TextCriteria diacriticSensitive(boolean diacriticSensitive)
      Optionally enable or disable diacritic sensitive search against version 3 text indexes.
      Parameters:
      diacriticSensitive - boolean flag to enable/disable.
      Returns:
      never null.
      Since:
      1.10
    • getKey

      public String getKey()
      Description copied from interface: CriteriaDefinition
      Get the identifying key.
      Specified by:
      getKey in interface CriteriaDefinition
      Returns:
      can be null.
    • getCriteriaObject

      public org.bson.Document getCriteriaObject()
      Description copied from interface: CriteriaDefinition
      Get Document representation.
      Specified by:
      getCriteriaObject in interface CriteriaDefinition
      Returns:
      never null.
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object