Class BaseSearchQuery

java.lang.Object
com.webmethods.caf.faces.search.query.BaseSearchQuery
All Implemented Interfaces:
ISearchQuery, Serializable, Cloneable
Direct Known Subclasses:
WmCommonSearch65xSearchQuery

public abstract class BaseSearchQuery extends Object implements ISearchQuery, Cloneable, Serializable
Abstract base class for SearchQuery implementations.
See Also:
  • Field Details

    • fInvocationID

      protected Integer fInvocationID
    • fMaxResults

      protected Integer fMaxResults
    • fKeywordsField

      protected String fKeywordsField
    • fRefineFields

      protected Map<String,Object> fRefineFields
    • fUseOrCondition

      protected Boolean fUseOrCondition
    • fKeywordTerms

      protected transient String[] fKeywordTerms
    • fNormalizedKeywordTerms

      protected transient String[] fNormalizedKeywordTerms
  • Constructor Details

    • BaseSearchQuery

      public BaseSearchQuery()
  • Method Details

    • getNormalizedSearchTerms

      public static String[] getNormalizedSearchTerms(String query)
      Parses query into single normalized terms.
      Returns:
      the normalized keyword terms for the query
    • clear

      public void clear()
      Reset the query state back to the original values
      Specified by:
      clear in interface ISearchQuery
    • getInvocationID

      public Integer getInvocationID()
      Gets the search invocation. This value changes every time the user does a new search action. If the value is zero, then no search has been executed yet.
      Specified by:
      getInvocationID in interface ISearchQuery
      Returns:
      the id of the search invocation or zero if no search has been executed yet.
    • setInvocationID

      public void setInvocationID(Integer invokeID)
      Sets the search invocation id
      Specified by:
      setInvocationID in interface ISearchQuery
      Parameters:
      invokeID - the id of the search invocation
    • clone

      protected Object clone() throws CloneNotSupportedException
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • getMaxResults

      public Integer getMaxResults()
      Gets the maximum number of results allowed
      Specified by:
      getMaxResults in interface ISearchQuery
      Returns:
      max results number
    • setMaxResults

      public void setMaxResults(Integer maxResults)
      Sets the max number of results allowed.
      Parameters:
      maxResults - The maxResults to set.
    • getUseOrCondition

      public Boolean getUseOrCondition()
      Returns true if the refine fields should be treated as 'OR' terms, or false if the fields should be treated as 'AND' terms.
      Specified by:
      getUseOrCondition in interface ISearchQuery
      Returns:
      true or false
    • isUseOrCondition

      public Boolean isUseOrCondition()
      Returns true if the refine fields should be treated as 'OR' terms, or false if the fields should be treated as 'AND' terms.
      Returns:
      true or false
    • setUseOrCondition

      public void setUseOrCondition(Boolean useOrCondition)
      Sets whether the refine fields should be treated as 'OR' terms or 'AND' terms.
      Parameters:
      useOrCondition - true of 'OR' terms, false for 'AND' terms
    • getKeywordsField

      public String getKeywordsField()
      Gets the raw value of the keywords field
      Specified by:
      getKeywordsField in interface ISearchQuery
      Returns:
      the raw value of the keywords field
    • setKeywordsField

      public void setKeywordsField(String keywordsField)
      Sets the raw value of the keywords field
      Parameters:
      keywordsField - The keywordsField to set.
    • getKeywordTerms

      public String[] getKeywordTerms()
      Gets the keywords parsed into terms
      Specified by:
      getKeywordTerms in interface ISearchQuery
      Returns:
      array of keyword terms
    • getNormalizedKeywordTerms

      public String[] getNormalizedKeywordTerms()
      Gets the keywords parsed into normalized terms
      Specified by:
      getNormalizedKeywordTerms in interface ISearchQuery
      Returns:
      array of normalized terms
    • getRefineFields

      public Map<String,Object> getRefineFields()
      Return the map of refine fields
      Specified by:
      getRefineFields in interface ISearchQuery
      Returns:
      refine fields map
    • setRefineFields

      public void setRefineFields(Map<String,Object> refineFields)
      Sets the refine field map
      Parameters:
      refineFields - The refineFields to set.
    • populateFromSearchStateString

      public abstract void populateFromSearchStateString(String stateString)
      Import the search state from a state string
      Specified by:
      populateFromSearchStateString in interface ISearchQuery
      Parameters:
      stateString - the search state string (from toSearchStateString method)
    • toSearchStateString

      public abstract String toSearchStateString(ISearchStateOptions options)
      Export the search state to a string
      Specified by:
      toSearchStateString in interface ISearchQuery
      Parameters:
      options - the options to use when writing the search state
      Returns:
      search state as a string
    • cloneSearchQuery

      public ISearchQuery cloneSearchQuery()
      Makes a clone of this search query
      Specified by:
      cloneSearchQuery in interface ISearchQuery
    • parseSearchTerms

      protected static String[] parseSearchTerms(String s)
      Splits the given query string to search terms. The string is split at the spaces. If there are quotes in the string the text between the quotes is treated as a single term.
      Parameters:
      s - the search query string
      Returns:
      list of search terms
    • parseSearchTerms

      protected static String[] parseSearchTerms(String s, boolean normalize)
      Splits the given query string to search terms. The string is split at the spaces. If there are quotes in the string the text between the quotes is treated as a single term.
      Parameters:
      s - the search query string
      normalize - true to normalize the string before parsing, false otherwise
      Returns:
      list of search terms
    • makeContainsTerm

      protected String makeContainsTerm(String temp)
      Wrapps the value with wildcard characters
      Parameters:
      temp - the value to wrap
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object