Forums de discussion

Creating a portlet with search capabilities

Rastislav Papp, modifié il y a 14 années.

Creating a portlet with search capabilities

New Member Publications: 7 Date d'inscription: 11/03/10 Publications récentes
Hi.

I've created a portlet and I would like to be able to search in it's content via the default Search portlet in Liferay. So I've followed this article and sources for other portlets that have search capabilities.

I am using Solr as search engine and my portlet is successful in adding documents to the index (I can see it in the Solr log). But I have problem with the search, when I try to search for something, I see in the Solr log that it is found (my subclass of HitsOpenSearchImpl returns valid Hits), but in the liferay log two exceptions occur:

ERROR [InstancePool:107] Unable to load eu.ibacz.personmanager.search.Indexer with the portal class loader or the current context class loader
java.lang.ClassNotFoundException: eu.ibacz.personmanager.search.Indexer
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
        at com.liferay.portal.kernel.util.InstancePool._get(InstancePool.java:99)
        at com.liferay.portal.kernel.util.InstancePool._get(InstancePool.java:66)
        at com.liferay.portal.kernel.util.InstancePool.get(InstancePool.java:44)
        at com.liferay.portal.search.HitsOpenSearchImpl.search(HitsOpenSearchImpl.java:111)
        ...
        ...
ERROR [jsp:1109] eu.ibacz.personmanager.search.PersonOpenSearchImpl java.lang.NullPointerException

The first exception is very strange, because when I push the button Reindex in administration on this portlet, it clearly works, so the method reindex in Indexer is used, so I have no idea why it does not find the Indexer class when I try to search.

The second exception does not provide any explanation or stack trace and I assume it is caused by the first problem.

Also I don't know what should I return in my subclass of HitsOpenSearchImpl - PersonOpenSearchImpl in method String getSearchPath(). Other portlets (bookmarks, blogs,...) return for example "/c/blogs/open_search", so I return "/c/persons/open_search", but I have no idea where this URL should come from, what does it represent or where is it used. Maybe this is the source of all my problems...
Heba El Ayoty, modifié il y a 13 années.

RE: Creating a portlet with search capabilities

New Member Publications: 12 Date d'inscription: 20/10/10 Publications récentes
I'm facing the same problem, did you find any solution in liferay 6?
thumbnail
Aaron Daubman, modifié il y a 13 années.

RE: Creating a portlet with search capabilities

New Member Publications: 4 Date d'inscription: 28/09/10 Publications récentes
*bump*

Needing to do this as well and wishing for an updated version of:
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Adding+search+capabilities+to+a+portlet

for Liferay 6.0EE with Solr 1.4.1