wso2 / product-greg

Welcome to the WSO2 Governance Registry source code! For info on working with the WSO2 Governance Registry repository and contributing code, click the link below.
http://wso2.github.io/
Other
41 stars 95 forks source link

G-REG search does not work with special characters #905

Open saranki opened 4 years ago

saranki commented 4 years ago

Description: Some searches do not work with special characters like "/", ")". An example is the File artifact has value M/M_M) in the Notes fields. Perform a search on value M/M_M) from the File search menu - no matches. If you use quotes around the search value it works like "M/M_M)"

Affected Product Version: wso2greg-5.3.0

Steps to reproduce:

  1. Created a file in the Publisher
  2. Added note with special characters, Test-M/M_M).
  3. When we searched for M/M_M) and Test-M/M_M) we didn't get any output. Furthermore, we also got the following error message in the wso2carbon.log file.

    [2020-06-01 20:19:48,898] ERROR {org.wso2.carbon.registry.indexing.service.ContentBasedSearchService} -  Invalid Search Query, query contains invalid characters
    org.apache.solr.common.SolrException: org.apache.solr.search.SyntaxError: Cannot parse 'overview_name_s:*m/m_m)* OR *m/m_m)*': Encountered " ")" ") "" at line 1, column 22.
    Was expecting one of:
    <EOF> 
    <AND> ...
    <OR> ...
    <NOT> ...
    "+" ...
    "-" ...
    <BAREOPER> ...
    "(" ...
    "*" ...
    "^" ...
    <QUOTED> ...
    <TERM> ...
    <FUZZY_SLOP> ...
    <PREFIXTERM> ...
    <WILDTERM> ...
    <REGEXPTERM> ...
    "[" ...
    "{" ...
    <LPARAMS> ...
    <NUMBER> ...
    .
    .
    .
    Caused by: org.apache.solr.search.SyntaxError: Cannot parse 'overview_name_s:*m/m_m)* OR *m/m_m)*': Encountered " ")" ") "" at line 1, column 22.
    Was expecting one of:
    <EOF> 
    <AND> ...
    <OR> ...
    <NOT> ...
    "+" ...
    "-" ...
    <BAREOPER> ...
    "(" ...
    "*" ...
    "^" ...
    <QUOTED> ...
    <TERM> ...
    <FUZZY_SLOP> ...
    <PREFIXTERM> ...
    <WILDTERM> ...
    <REGEXPTERM> ...
    "[" ...
    "{" ...
    <LPARAMS> ...
    <NUMBER> ...
    
    at org.apache.solr.parser.SolrQueryParserBase.parse(SolrQueryParserBase.java:155)
    at org.apache.solr.search.LuceneQParser.parse(LuceneQParser.java:50)
    at org.apache.solr.search.QParser.getQuery(QParser.java:141)
    at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:203)
    ... 114 more
    Caused by: org.apache.solr.parser.ParseException: Encountered " ")" ") "" at line 1, column 22.