Class SearchTokenizer

java.lang.Object
com.sap.cds.adapter.odata.v2.search.SearchTokenizer

public class SearchTokenizer extends Object
 searchExpr    = ( OPEN BWS searchExpr BWS CLOSE / searchTerm )
                 [ searchOrExpr / searchAndExpr ]
 searchOrExpr  = RWS 'OR' RWS searchExpr
 searchAndExpr = RWS [ 'AND' RWS ] searchExpr
 searchTerm    = [ 'NOT' RWS ] ( searchPhrase / searchWord )
 searchPhrase  = quotation-mark 1*qchar-no-AMP-DQUOTE quotation-mark
 searchWord    = 1*ALPHA ; Actually: any character from the Unicode categories L or Nl,
                                     but not the words AND, OR, and NOT
 
ATTENTION: This class does not support a percent-encoded searchPhrase because the URI parser percent decodes each query before calling parsers of query options.
  • Constructor Details

    • SearchTokenizer

      public SearchTokenizer()
  • Method Details

    • tokenize

      public List<SearchQueryToken> tokenize(String searchQuery)
      Takes the search query and splits it into a list of corresponding SearchQueryTokens. Before splitting it into tokens, leading and trailing whitespace in the given search query string is removed.
      Parameters:
      searchQuery - search query to be tokenized
      Returns:
      list of tokens