Class SearchTextParser.QueryTerm

java.lang.Object
ch.tocco.nice2.toolbox.api.string.SearchTextParser.QueryTerm
Enclosing class:
SearchTextParser

public static class SearchTextParser.QueryTerm extends Object
The result of one term in the user's search input. A QueryTerm represents a "quoted phraze" or a simple space-separated word.

Except for the useCounter this class is immutable.

  • Constructor Details

    • QueryTerm

      public QueryTerm(String term, boolean isPhraze)
  • Method Details

    • used

      public void used()
      Informs the query term that it was used in the search by some field.
    • getUseCount

      public int getUseCount()
      Tells by how many database record fields this term was used.
      Returns:
      0-n where 0 means the term was ignored (may be indicated to the user). This happens for example with terms that every field considers too short, or with wildcard-only terms, or another example is a "string" term when the entity only contains numeric fields.
    • getTerm

      public String getTerm()
    • isPhraze

      public boolean isPhraze()
    • containsWildcard

      public boolean containsWildcard()
    • containsAnyWildcard

      public boolean containsAnyWildcard()
    • startsWithWildcard

      public boolean startsWithWildcard()
    • containsOnlySingleCharWildcardsInBetween

      public boolean containsOnlySingleCharWildcardsInBetween()
      Returns:
      true if the string contains no "*" wildcard at all, and one or multiple one letter wildcards "_" but they must occur in the middle of the word (not begin or end).
    • getAmountOfNonWildcard

      public int getAmountOfNonWildcard()
      See Also:
    • isAsciiLetter

      public boolean isAsciiLetter()
      Tells if the term is us-ascii a-z and A-Z only.
    • isNumber

      public boolean isNumber()
    • isDate

      public boolean isDate()
    • getAsDate

      public org.joda.time.LocalDate getAsDate()
      Note that if the date was entered without the century then the century is 0! You may want to interpret it as the current/last/next century depending on data type and circumstances. null if not isChronological().
    • isTime

      public boolean isTime()
    • getAsTime

      public org.joda.time.LocalTime getAsTime()