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 and Description |
|---|
SearchTokenizer() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isAllowedWord(char character) |
List<SearchQueryToken> |
tokenize(String searchQuery)
Takes the search query and splits it into a list of corresponding
SearchQueryTokens. |
public List<SearchQueryToken> tokenize(String searchQuery) throws SearchTokenizerException
SearchQueryTokens.
Before splitting it into tokens, leading and trailing whitespace in the given search query string is removed.searchQuery - search query to be tokenizedSearchTokenizerException - if something in query is not valid (based on OData search query ABNF)public static boolean isAllowedWord(char character)
Copyright © 2023. All rights reserved.