Class SearchTokenizer

java.lang.Object
org.apache.olingo.server.core.uri.parser.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's parseUri method percent decodes each query before calling parsers of query options.
  • Constructor Details

    • SearchTokenizer

      public SearchTokenizer()
  • Method Details

    • tokenize

      public List<SearchQueryToken> tokenize(String searchQuery) throws SearchTokenizerException
      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
      Throws:
      SearchTokenizerException - if something in query is not valid (based on OData search query ABNF)
    • isAllowedWord

      public static boolean isAllowedWord(char character)