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

Search portlet breaks/no results when searching for keywords with special Solr (Lucene) characters when portal is configured with Solr 4 server

Details

    Description

      master/7.0.x: Resolved as part of LPS-72226 which cannot be backported as-is to 62x. Requires adaption.


      Steps to reproduce 6.2.x: - Case 1

      1. Start portal
      2. Create a Web Content Article with title /warehouses
      3. Add Web Content Search or Search portlet to a page
      4. Search for /warehouses
        Result: Article found
      5. Install and configure Solr 4 with Liferay 6.2 (https://customer.liferay.com/documentation/knowledge-base/-/kb/29940) - Reproduced with Liferay Solr 4 Search Engine 2.1.0
      6. Reindex search indexes from the Server Admin
      7. Search for /warehouses again
        Actual Result: Article not found
        Expected Result: Article found

      Steps to reproduce 6.2.x: - Case 2

      1. Add Web Content Search or Search portlet to a page
      2. Search for + or ! or - or other special Solr characters (https://github.com/apache/lucene-solr/blob/releases/lucene-solr/4.3.1/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserBase.java#L1250-L1257)
        Actual Result: The search portlet crashes with
        16:20:21,966 ERROR [http-bio-6211-exec-5][IncludeTag:129] Current URL /web/guest/home?_3_formDate=1508421719798&p_p_id=3&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&_3_struts_action=%2Fsearch%2Fsearch&_3_cur=1&_3_format=&_3_keywords=%2B&_3_groupId=0&_3_entryClassName=&_3_folderId=&_3_userName=&_3_modified=&_3_modifiedselection=0&_3_modifiedfrom=10%2F18%2F2017&_3_modifieddayFrom=17&_3_modifiedmonthFrom=9&_3_modifiedyearFrom=2017&_3_modifiedto=10%2F19%2F2017&_3_modifieddayTo=18&_3_modifiedmonthTo=9&_3_modifiedyearTo=2017&_3_documentsSearchContainerPrimaryKeys=15_PORTLET_21113 generates exception: com.liferay.portal.kernel.search.SearchException: com.liferay.portal.kernel.search.SearchException: org.apache.solr.search.SyntaxError: Cannot parse '+(+(+(companyId:20155) +((+(entryClassName:com.liferay.portal.model.User) +(status:0)) (+(entryClassName:com.liferay.portlet.bookmarks.model.BookmarksEntry) +(status:0)) (+(entryClassName:com.liferay.portlet.bookmarks.model.BookmarksFolder) +(status:0)) (+(entryClassName:com.liferay.portlet.blogs.model.BlogsEntry) +(status:0)) (+(entryClassName:com.liferay.portlet.documentlibrary.model.DLFileEntry) +(status:0) +(hidden:false)) (+(entryClassName:com.liferay.portlet.documentlibrary.model.DLFolder) +(status:0) +(hidden:false)) (+(entryClassName:com.liferay.portlet.journal.model.JournalArticle) +(status:0) +(head:true)) (+(entryClassName:com.liferay.portlet.journal.model.JournalFolder) +(status:0)) (+(entryClassName:com.liferay.portlet.messageboards.model.MBMessage) +(status:0) +(discussion:false)) (+(entryClassName:com.liferay.portlet.wiki.model.WikiPage) +(status:0)))) +(assetCategoryTitles:+* assetCategoryTitles_en_US:+* assetTagNames:+* -stagingGroup:true comments:+ content:+ description:+ properties:+ title:+ url:+ userName:+* city:+ country:+ emailAddress:+* firstName:+ fullName:+ lastName:+ middleName:+ region:+ screenName:+ street:+ zip:+ ddmContent:+ extension:+ fileEntryTypeId:+ path:+* classPK:+ content_en_US:+ description_en_US:+ entryClassPK:+ title_en_US:+ type:+ articleId:+)) +companyId:20155': Encountered " "+" "+ "" at line 1, column 902._Was expecting one of:_    <BAREOPER> ..._    "(" ..._    "*" ..._    <QUOTED> ..._    <TERM> ..._    <PREFIXTERM> ..._    <WILDTERM> ..._    <REGEXPTERM> ..._    "[" ..._    "{" ..._    <LPARAMS> ..._    <NUMBER> ..._     [Sanitized]
        com.liferay.portal.kernel.search.SearchException: org.apache.solr.search.SyntaxError: Cannot parse '+(+(+(companyId:20155) +((+(entryClassName:com.liferay.portal.model.User) +(status:0)) (+(entryClassName:com.liferay.portlet.bookmarks.model.BookmarksEntry) +(status:0)) (+(entryClassName:com.liferay.portlet.bookmarks.model.BookmarksFolder) +(status:0)) (+(entryClassName:com.liferay.portlet.blogs.model.BlogsEntry) +(status:0)) (+(entryClassName:com.liferay.portlet.documentlibrary.model.DLFileEntry) +(status:0) +(hidden:false)) (+(entryClassName:com.liferay.portlet.documentlibrary.model.DLFolder) +(status:0) +(hidden:false)) (+(entryClassName:com.liferay.portlet.journal.model.JournalArticle) +(status:0) +(head:true)) (+(entryClassName:com.liferay.portlet.journal.model.JournalFolder) +(status:0)) (+(entryClassName:com.liferay.portlet.messageboards.model.MBMessage) +(status:0) +(discussion:false)) (+(entryClassName:com.liferay.portlet.wiki.model.WikiPage) +(status:0)))) +(assetCategoryTitles:+* assetCategoryTitles_en_US:+* assetTagNames:+* -stagingGroup:true comments:+ content:+ description:+ properties:+ title:+ url:+ userName:+* city:+ country:+ emailAddress:+* firstName:+ fullName:+ lastName:+ middleName:+ region:+ screenName:+ street:+ zip:+ ddmContent:+ extension:+ fileEntryTypeId:+ path:+* classPK:+ content_en_US:+ description_en_US:+ entryClassPK:+ title_en_US:+ type:+ articleId:+)) +companyId:20155': Encountered " "+" "+ "" at line 1, column 902._Was expecting one of:_    <BAREOPER> ..._    "(" ..._    "*" ..._    <QUOTED> ..._    <TERM> ..._    <PREFIXTERM> ..._    <WILDTERM> ..._    <REGEXPTERM> ..._    "[" ..._    "{" ..._    <LPARAMS> ..._    <NUMBER> ..._     [Sanitized]
        	at com.liferay.portal.search.solr.SolrIndexSearcher.search(SolrIndexSearcher.java:131)
        	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.search(SearchEngineUtil.java:671)
        	at com.liferay.portal.kernel.search.FacetedSearcher.doSearch(FacetedSearcher.java:279)
        	at com.liferay.portal.kernel.search.DefaultSearchResultPermissionFilter.getHits(DefaultSearchResultPermissionFilter.java:93)
        	at com.liferay.portal.kernel.search.BaseSearchResultPermissionFilter.search(BaseSearchResultPermissionFilter.java:54)
        	at com.liferay.portal.kernel.search.BaseIndexer.search(BaseIndexer.java:624)
        	at org.apache.jsp.html.portlet.search.search_jsp._jspService(search_jsp.java:1088)
        	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        	at com.liferay.portal.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:57)
        	at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.doDispatch(ClassLoaderRequestDispatcherWrapper.java:78)
        	at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.include(ClassLoaderRequestDispatcherWrapper.java:53)
        	at com.liferay.taglib.util.IncludeTag.include(IncludeTag.java:290)
        

      Solution Notes
      The issue was address in the portal side, does not require a new version of Liferay Solr 4 Search Engine app to be used.

      Attachments

        Issue Links

          Activity

            People

              raven.song Raven Song
              josemaria.munoz José María Muñoz
              Kiyoshi Lee Kiyoshi Lee
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                5 years, 29 weeks, 5 days ago

                Packages

                  Version Package
                  6.2.X EE