Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-52496

Searching for special (Lucene) characters causes "org.apache.solr.search.SyntaxError: Cannot parse..." in Solr when spell-check ("Did you mean...") enabled

    Details

      Description

      Steps - 7.x/master
      Will be solved as part of LPS-73569.


      Steps - 6.2

      1. Integrate Liferay 6.2 with Solr 4.x (Reproduced with Liferay Solr 4 Search Engine 2.1.0)
      2. Reindex
      3. Reindex spell-check
      4. Add Search Portlet to a page
      5. Enable "Did you mean..." feature in the portlet configuration (set threshold to 1 for simplicity)
      6. Search for mafe
        "Did you mean: cafe" or sg like that is displyed
      7. Search for title:foo
        Result:
        62x log
        code}
        Caused by: org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: org.apache.solr.search.SyntaxError: Cannot parse 'gram3:itl OR gram3:tle OR gram3:le: OR gram3:e:f OR gram3::fo OR gram4:itle OR gram4:tle: OR gram4:le:f OR gram4:e:fo OR end4::foo OR end3:foo OR start3:tit OR start4:titl OR spellCheckWord:title:foo': Encountered " ":" ": "" at line 1, column 34.__Was expecting one of:__    <EOF> __    <AND> ...__    <OR> ...__    <NOT> ...__    "+" ...__    "-" ...__    <BAREOPER> ...__    "(" ...__    "*" ...__    "^" ...__    <QUOTED> ...__    <TERM> ...__    <FUZZY_SLOP> ...__    <PREFIXTERM> ...__    <WILDTERM> ...__    <REGEXPTERM> ...__    "[" ...__    "{" ...__    <LPARAMS> ...__    <NUMBER> ...__     [Sanitized]
        	at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:402)
        	at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)
        	at com.liferay.portal.search.solr.server.BaseHttpSolrServer.request(BaseHttpSolrServer.java:65)
        	at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90)
        	at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:310)
        	at com.liferay.portal.search.solr.SolrQuerySuggester.suggestKeywords(SolrQuerySuggester.java:273)
        	... 259 more
        16:29:57,734 ERROR [http-bio-8080-exec-5][IncludeTag:129] Current URL /web/guest/home?p_p_id=3&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&p_p_col_id=column-1&_3_struts_action=%2Fsearch%2Fsearch&_3_redirect=%2Fweb%2Fguest%2Fhome&_3_keywords=title%3Afoo&_3_groupId=0 generates exception: An exception occurred processing JSP page /html/portlet/search/main_search.jspf at line 63____60: __61: Indexer indexer = FacetedSearcher.getInstance();__62: __63: Hits hits = indexer.search(searchContext);__64: __65: String[] queryTerms = hits.getQueryTerms();__66: ______Stacktrace: [Sanitized]
        org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: org.apache.solr.search.SyntaxError: Cannot parse 'gram3:itl OR gram3:tle OR gram3:le: OR gram3:e:f OR gram3::fo OR gram4:itle OR gram4:tle: OR gram4:le:f OR gram4:e:fo OR end4::foo OR end3:foo OR start3:tit OR start4:titl OR spellCheckWord:title:foo': Encountered " ":" ": "" at line 1, column 34.__Was expecting one of:__    <EOF> __    <AND> ...__    <OR> ...__    <NOT> ...__    "+" ...__    "-" ...__    <BAREOPER> ...__    "(" ...__    "*" ...__    "^" ...__    <QUOTED> ...__    <TERM> ...__    <FUZZY_SLOP> ...__    <PREFIXTERM> ...__    <WILDTERM> ...__    <REGEXPTERM> ...__    "[" ...__    "{" ...__    <LPARAMS> ...__    <NUMBER> ...__     [Sanitized]
        	at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:402)
        	at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)
        	at com.liferay.portal.search.solr.server.BaseHttpSolrServer.request(BaseHttpSolrServer.java:65)
        	at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90)
        	at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:310)
        	at com.liferay.portal.search.solr.SolrQuerySuggester.suggestKeywords(SolrQuerySuggester.java:273)
        	at com.liferay.portal.search.solr.SolrQuerySuggester.suggestKeywords(SolrQuerySuggester.java:224)
        	at com.liferay.portal.search.solr.SolrQuerySuggester.spellCheckKeywords(SolrQuerySuggester.java:84)
        	at com.liferay.portal.kernel.search.BaseQuerySuggester.spellCheckKeywords(BaseQuerySuggester.java:29)
        	at com.liferay.portal.kernel.search.BaseIndexSearcher.spellCheckKeywords(BaseIndexSearcher.java:47)
        	at com.liferay.portal.kernel.messaging.proxy.ProxyRequest.execute(ProxyRequest.java:85)
        	at com.liferay.portal.kernel.messaging.proxy.ProxyMessageListener.receive(ProxyMessageListener.java:51)
        	at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:72)
        	at com.liferay.portal.kernel.messaging.SynchronousDestination.send(SynchronousDestination.java:41)
        	at com.liferay.portal.kernel.messaging.sender.DirectSynchronousMessageSender.send(DirectSynchronousMessageSender.java:54)
        	at com.liferay.portal.kernel.messaging.proxy.BaseMultiDestinationProxyBean.synchronousSend(BaseMultiDestinationProxyBean.java:48)
        	at com.liferay.portal.messaging.proxy.MultiDestinationMessagingProxyInvocationHandler.invoke(MultiDestinationMessagingProxyInvocationHandler.java:50)
        	at com.liferay.portal.kernel.search.SearchEngineUtil.spellCheckKeywords(SearchEngineUtil.java:760)
        	at com.liferay.portal.kernel.search.CollatedSpellCheckHitsProcessor.process(CollatedSpellCheckHitsProcessor.java:42)
        	at com.liferay.portal.kernel.search.CompositeHitsProcessor.process(CompositeHitsProcessor.java:41)
        

      Expected results: No errors.


      Solution Notes
      Fixed in Liferay Solr 4 Search Engine 2.1.1

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  2 years, 22 weeks, 3 days ago

                  Packages

                  Version Package
                  6.2.X EE