[
https://issues.apache.org/jira/browse/OLINGO-1378?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16898891#comment-16898891
]
Ralf Handl commented on OLINGO-1378:
------------------------------------
The OData 4.0 syntax for $search was overly restrictive regarding special
characters, this has been relaxed in OData 4.01, see
[https://github.com/oasis-tcs/odata-abnf/blob/master/abnf/odata-abnf-construction-rules.txt#L352-L360]:
{quote}
A searchWord is a sequence of one or more non-whitespace characters, excluding
- literal or percent-encoded parentheses "(", "%28", "%29", ")"
- literal or percent-encoded double-quotes '"' and "%22"
- the semicolon ";"
Percent-encoding is allowed, and required for characters with special meaning
in the query part of a URL, especially "&" and "#".
Note: the words AND, OR, and NOT are sometimes operators, depending on their
position within a search expression.
{quote}
This means that from a specification perspective double percent-encoding is
never necessary, and single percent-encoding of the special characters # & | is
necessary and sufficient.
Note that {{$search=bike%20%26%20car}} will match text that contains {{bike}}
and {{&}} and {{car}}, the {{&}} is just a character and the two spaces are
treated as implicit AND operators. Similar for {{|}}: it needs to be
percent-encoded and is treated just as a character.
It is still not possible to search for double-quotes, they are used to enclose
phrases demanding exact, non-fuzzy match.
> $search does not allow some special characters in search term
> -------------------------------------------------------------
>
> Key: OLINGO-1378
> URL: https://issues.apache.org/jira/browse/OLINGO-1378
> Project: Olingo
> Issue Type: Bug
> Components: odata4-server
> Affects Versions: (Java) V4 4.0.0
> Reporter: Prakash Sagadevan
> Priority: Major
>
> OLINGO 4.4.0 $search does not allow to search for special chars, eg. # & | ".
> *Example:*
> {code:java}
> http://host/service/Products?$search=#bike
> {code}
> {code:java}
> http://host/service/Products?$search=bike & car
> {code}
> {code:java}
> http://host/service/Products?$search=bike | car
> {code}
> {code:java}
> http://host/service/Products?$search=""bike car""
> {code}
> OData Accept the below character in $search system query
> ||Symbol||Character||
> |A..Z|Capital Alphabet|
> |a..z|Small Alphabet|
> |0..9|Numbers|
> |-|Hyphen|
> |.|Dot|
> |_|Under scope|
> |~|Tilde|
> |!|Not symbol|
> |(|Open parentheses|
> |)|Close parentheses|
> |*|Star|
> |+|Plus|
> |,|Comma|
> |;|Semicolon|
> |:|Colon|
> |@|Email|
> |/|Slash|
> |$|Dollar|
> |'|Single quotes|
> |=|Equal|
> |%|Percentage|
> | |Space|
> |\t|Tab|
> we are getting the issue in below special character,
> ||Symbol|
> |#|
> |&|
> |||
> |"|
> Workaround: Double encoded above special characters.
> {code:java}
> http://host/service/Products?$search=%2523bike
> http://host/service/Products?$search=bike %2526 car
> http://host/service/Products?$search=bike %257C car
> http://host/service/Products?$search="%2522bike car%2522"
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)