Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Firas BD
Liferay search users with Solr
November 21, 2011 9:24 AM
Answer

Firas BD

Rank: Junior Member

Posts: 43

Join Date: October 3, 2011

Recent Posts

Hi

I am using Liferay 6 bundled with tomcat. For a powerful full-text search I am using Solr: Here are the steps:

1-Download the Apache-solr-1.4.1
2-Download solr-web-6.0.1.1 plugin
3-Mark the root of installation folder of apache-solr as the variable $SOLR_HOME
4-Start Liferay tomcat and deploy the plugin (.war)
5-Shut down liferay tomcat
6-Copy the schema.xml file from the solr-web/WEB-INF/conf folder which is deployed and paste/replace in SOLR_HOME/example/solr/conf folder.
7-Change the solr url as follows in solr-spring.xml which is located in solr-web/WEB-INF/classes/META-INF/ folder.
Change from this content :
<bean id="solrServer"
class="com.liferay.portal.search.solr.server.BasicAuthSolrServer">

<constructor-arg type="java.lang.String" value="http://localhost:8080/solr" />

</bean>


to this :

<bean id="solrServer"
class="com.liferay.portal.search.solr.server.BasicAuthSolrServer">

<constructor-arg type="java.lang.String" value="http://localhost:8983/solr" />

</bean>


8-Start the Solr server using the following command from SOLR_HOME/example folder in command prompt/terminal.
Java -jar start.jar

9-To solve this error:

log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@1ac1fe4
] whereas object of type
log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@1ac1fe4
].
log4j:ERROR Could not instantiate appender named "CONSOLE".


Delete the above log4j.jar, logging.properties, and log4j.properties files from solr-web after the plugin is deployed, clean the cache, and restart Tomcat. However, this issue will come back again if you redeploy the plugin.

tomcat-6.0.18\webapps\solr-web\WEB-INF\classes\log4j.properties
tomcat-6.0.18\webapps\solr-web\WEB-INF\classes\logging.properties
tomcat-6.0.18\webapps\solr-web\WEB-INF\lib\log4j.jar


10-Start the liferay tomcat server now.
11-Add the search portlet in the home page. and reindex all search indexs from the server administration which is in control panel.
12-Test seraches.

The problem: When I am searching for a user or an organisation, it sends me an unsuccessful search.

What I have to do? Any help !!
Hitoshi Ozawa
RE: Liferay search users with Solr
November 21, 2011 3:30 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7954

Join Date: March 23, 2010

Recent Posts

This may not be the solution you're asking for, but for a quick solution, just set the followings in the portal-ext.properties

users.search.with.index=false
organizations.search.with.index=false
Firas BD
RE: Liferay search users with Solr
November 22, 2011 3:09 AM
Answer

Firas BD

Rank: Junior Member

Posts: 43

Join Date: October 3, 2011

Recent Posts

But I am using the databse embeded (hsql database) I just want how to configure Solr to index users and organizations as far as the portal content ( blogs , forums and documents ...)
Rajesh Nathi
RE: Liferay search users with Solr
December 12, 2012 1:11 PM
Answer

Rajesh Nathi

Rank: Junior Member

Posts: 71

Join Date: March 8, 2011

Recent Posts

Hi Firas,

I followed the steps you mentioned , but when i start Liferay server (6.0.6) i see below error in the catalina.out file.

INFO: [collection1] webapp=/solr path=/update params={waitSearcher=true&waitFlush=true&wt=javabin&commit=true&version=2.2} {commit=} 0 12
Dec 12, 2012 9:53:32 PM org.apache.solr.update.processor.LogUpdateProcessor finish
INFO: [collection1] webapp=/solr path=/update params={wt=javabin&version=2.2} {} 0 1
Dec 12, 2012 9:53:32 PM org.apache.solr.common.SolrException log
SEVERE: org.apache.solr.common.SolrException: Document is missing mandatory uniqueKey field: id
at org.apache.solr.update.AddUpdateCommand.getIndexedId(AddUpdateCommand.java:88)
at org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:445)
at org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:325)
at org.apache.solr.update.processor.LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:100)
at org.apache.solr.handler.loader.XMLLoader.processUpdate(XMLLoader.java:230)
at org.apache.solr.handler.loader.XMLLoader.load(XMLLoader.java:157)
at org.apache.solr.handler.UpdateRequestHandler$1.load(UpdateRequestHandler.java:92)
at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:74)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1699)
at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:455)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:276)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1337)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:484)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.eclipse.jetty.server.Server.handle(Server.java:351)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)
at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:900)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:954)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:857)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66)
at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:254)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
at java.lang.Thread.run(Unknown Source)

And in Solr(4.0.0) logs i see this :

request: http://localhost:8983/solr/update?wt=javabin&version=2.2
org.apache.solr.common.SolrException: Bad Request

Bad Request

request: http://localhost:8983/solr/update?wt=javabin&version=2.2
at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:343)
at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:183)
at com.liferay.portal.search.solr.server.BasicAuthSolrServer.request(BasicAuthSolrServer.java:93)
at org.apache.solr.client.solrj.request.UpdateRequest.process(UpdateRequest.java:217)
at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:63)
at com.liferay.portal.search.solr.SolrIndexWriterImpl.addDocument(SolrIndexWriterImpl.java:42)
at com.liferay.portal.search.solr.SolrIndexWriterImpl.updateDocument(SolrIndexWriterImpl.java:135)
at com.liferay.portal.kernel.search.messaging.SearchWriterMessageListener.doReceive(SearchWriterMessageListener.java:86)
at com.liferay.portal.kernel.search.messaging.SearchWriterMessageListener.receive(SearchWriterMessageListener.java:33)
at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:63)
at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:61)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
20:53:32,763 ERROR [SearchWriterMessageListener:36] Unable to process message {destinationName=liferay/search_writer, responseDestinationName=null, responseId=null, payload={companyId=0, document={uid=[PluginPackageIndexer_PORTLET_liferay/web-form-portlet/6.0.6.1/war], moduleId=[liferay/web-form-portlet/6.0.6.1/war], installedVersion=[6.0.6.1], status=[sameVersionInstalled], tag=[], artifactId=[web-form-portlet], osi-approved-license=, type=, pageURL=[http://www.liferay.com], modified=[20121212205332], version=[6.0.6.1], content=[Web Form Portlet Liferay, Inc. ], groupId=, author=[Liferay, Inc.], title=[Web Form Portlet], repositoryURL=[LOCAL_URL], license=, portletId=[PluginPackageIndexer]}, documents=null, end=0, id=null, ids=null, query=null, searchEngineCommand=UPDATE_DOCUMENT, sorts=null, start=0}, values=null}
com.liferay.portal.kernel.search.SearchException: Bad Request


Could you please tell what could be the possible reason ? Thanks in advance