PUBLIC - Liferay Portal Community Edition
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-5408

Searching form Search Portlet - solr-web throwing null pointer exception - different from LPS-2885

    Details

    • Branch Version/s:
      5.2.x, 5.1.x
    • Liferay Contributor's Agreement:
      Accept
    • Similar Issues:
      Show 5 results 

      Description

      I have taken latest version of Portal and solr-web plugins from 5.2.x branches.

      I have Solr 1.3.

      Performed all the required steps to make solr work based on information available at various sources in community.

      Everything was setup fine and I can do seach in solr admin interface for liferay content.

      I can also do search in Control Panel.

      Issue was coming in Search Portlet. Anything I search was resulting in NPE like from all OpenSearchImpl. Only directory search was resulting the content.

      So search portlet is not working when configured with solr.

        Activity

        Hide
        Mahipalsinh Rana added a comment - - Restricted to

        I have done debugging to find out root cause of this issue and found that NPE is being thrown from class.

        portal-kernel/src/com/liferay/portal/kernel/search/HitsImpl.java

        In that class there is method

        public String snippet(int n)

        { return _snippets[n]; }

        But in my case _snippet is Null , so it throws NPE. I have small content in each of my blog , wiki and web content i.e "Test this feature" , I not sure why snippet is coming as null.

        So I have modified above function like

        public String snippet(int n) {
        if(_snippets == null)

        { return null; }

        return _snippets[n];
        }

        After doing this change and redeploying portal NPE Gone and it worked like charm.

        Show
        Mahipalsinh Rana added a comment - - Restricted to I have done debugging to find out root cause of this issue and found that NPE is being thrown from class. portal-kernel/src/com/liferay/portal/kernel/search/HitsImpl.java In that class there is method public String snippet(int n) { return _snippets[n]; } But in my case _snippet is Null , so it throws NPE. I have small content in each of my blog , wiki and web content i.e "Test this feature" , I not sure why snippet is coming as null. So I have modified above function like public String snippet(int n) { if(_snippets == null) { return null; } return _snippets [n] ; } After doing this change and redeploying portal NPE Gone and it worked like charm.
        Hide
        Mahipalsinh Rana added a comment - - Restricted to

        Diff of class : com.liferay.portal.kernel.search.HitsImpl.java

        @@ -107,6 +107,9 @@
        }

        public String snippet(int n) {
        + if(_snippets == null)

        { + return null; + }

        return _snippets[n];
        }

        This should solve the problem of NPE.

        Show
        Mahipalsinh Rana added a comment - - Restricted to Diff of class : com.liferay.portal.kernel.search.HitsImpl.java @@ -107,6 +107,9 @@ } public String snippet(int n) { + if(_snippets == null) { + return null; + } return _snippets [n] ; } This should solve the problem of NPE.
        Hide
        Shagul H Khajamohideen added a comment - - Restricted to

        Hi,

        Is this contribution going to make it to 5.3.0/ trunk soon?

        Thanks,

        Show
        Shagul H Khajamohideen added a comment - - Restricted to Hi, Is this contribution going to make it to 5.3.0/ trunk soon? Thanks,

          People

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

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              5 years, 20 weeks, 6 days ago

              Development

                Structure Helper Panel