Liferay is a Gartner Magic Quadrant Leader for the Sixth Year! Find out why
« Back to Search

Pluggable Enterprise Search with Solr

Integrating Solr 1.4.1 with Liferay 6.1 GA2/GA3 #

Before we begin, it's important to note that this tutorial will cover integrating Solr 1.4.1 with Liferay 6.1 GA2 or Liferay 6.1 GA3. Liferay 6.2 GA1 (and above) can be configured to use later versions of Solr, but that is not within the scope of this article. This tutorial will also cover how to configure basic replication between master and slave Solr servers with Liferay. You can find Solr 1.4.1 in the archives of Apache here

Downloading the Solr Search Engine Plugin and Verifying Deployment #

You can find Solr Search Engine Plugin in Liferay's Marketplace; just be sure to download the original version (not Solr 3 Search Engine or Solr 4 Search Engine). Version 1.0.2 should be the latest released version for this plugin, and it's the one we'll be using for this tutorial. It is compatible with both Liferay 6.1 GA2 and Liferay 6.1 GA3.

Before we deploy our Solr Search Engine Plugin to our portal, we need to check our ports. By default, Liferay's Tomcat bundle is set to run on port 8080, and by default, the Solr Search Engine Plugin is set to connect to a server on port 8080. Assuming you don't have Solr running on the same Tomcat instance as Liferay, one of the ports will need to change in order for the plugin to deploy correctly. At this point, we want to validate a successful deployment, so we're going to try to deploy the plugin without any Solr servers hooked up, just to see if Liferay tries to connect to an invalid server. Once we see the connection requests, we'll know that plugin was successfully deployed. Rather than change the ports for our Liferay server, we'll change the default port our Solr Search Engine Plugin wants to connect to before deploying. I used a file manager to view the contents of the .lpkg file without extracting it. On the first level, navigate into solr-web-6.1.20, and then into WEB-INF/classes/META-INF/ to find solr-spring.xml. Find this line: 

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

and replace 8080 with a different open port number (i.e. 8983). Once you save the file, close out of the file manager and verify that the Solr Search Engine Plugin .lpkg file is updated. You can now deploy this onto your Liferay portal, and once it is successfuly deployed, you should see an endless list of errors like this: 

INFO  [HttpMethodDirector:439] I/O exception (java.net.ConnectException) caught when processing request: Connection refused

INFO  [HttpMethodDirector:445] Retrying request

This is a good thing! The Solr Search Engine Plugin has been successfully deployed, and it's trying to connect to a port that we set to test Liferay's connection to Solr. Now we can move on to configuring actual Solr servers for Liferay to connect to.

Setting Up the Master and Slave Solr Servers #

If you don't already have existing Solr servers, this tutorial will help you set up two basic servers. If you already have Solr servers, you can skip to the next section.

After you've downloaded the archived Solr 1.4.1 zip or tar.gz from Apache, unzip it twice and rename the two files; we'll call them "Solr_master" and "Solr_slave." This tutorial will set up two Solr servers in the same directory as the Liferay server. For example, in a folder called tutorial, we would have /tutorial/liferay-portal-6.1.20-ee-ga2, /tutorial/Solr_master, and /tutorial/Solr_slave. Once you've renamed your two servers, there are a couple things we need to do to configure replication.

Replicating Solr #

The first thing we need to do is change the port number for the slave. In Solr_slave/example/etc, find jetty.xml and change the default port number:

<Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>

to another open port (i.e. 8984). Solr_slave is now set to a different port than Solr_master (which should still be on the default 8983). Next, we need to modify solrconfig.xml for both servers:

In Solr_master/example/solr/conf/solrconfig.xml, uncomment these lines:

<requestHandler name="/replication" class="solr.ReplicationHandler" >
    <lst name="master">
      <str name="replicateAfter">commit</str>
      <str name="replicateAfter">startup</str>
      <str name="confFiles">schema.xml,stopwords.txt</str>
    </lst>
</requestHandler>

In Solr_slave/example/solr/conf/solrconfig.xml, uncomment these lines:

<requestHandler name="/replication" class="solr.ReplicationHandler" >
    <lst name="slave">
      <str name="masterUrl">http://localhost:8983/solr/replication</str>
      <str name="pollInterval">00:00:60</str>
    </lst>
</requestHandler>

You can visit (http://wiki.apache.org/solr/SolrReplication]) for more detailed information on Solr replication.

Configuring solr-spring.xml to Connect to the Master and Slave Solr Servers #

Now we need to go back to solr-spring.xml in our deployed Solr Search Engine Plugin to modify the ports to connect to real servers. Before we do this, it might be a good idea to shut down Liferay. In /webapps/solr-web/WEB-INF/classes/META-INF/solr-spring.xml, make these changes:

	<!-- Solr search engine -->

	<bean id="com.liferay.portal.search.solr.server.BasicAuthSolrServerReader" class="com.liferay.portal.search.solr.server.BasicAuthSolrServer">
		<constructor-arg type="java.lang.String" value="http://localhost:8984/solr" />
	</bean>

	<bean id="com.liferay.portal.search.solr.server.BasicAuthSolrServerWriter" class="com.liferay.portal.search.solr.server.BasicAuthSolrServer">
		<constructor-arg type="java.lang.String" value="http://localhost:8983/solr" />
	</bean>

	<bean id="com.liferay.portal.search.solr.SolrIndexSearcherImpl" class="com.liferay.portal.search.solr.SolrIndexSearcherImpl">
		<property name="solrServer" ref="com.liferay.portal.search.solr.server.BasicAuthSolrServerReader" />
		<property name="swallowException" value="true" />
	</bean>
	<bean id="com.liferay.portal.search.solr.SolrIndexWriterImpl" class="com.liferay.portal.search.solr.SolrIndexWriterImpl">
		<property name="commit" value="false" />
		<property name="solrServer" ref="com.liferay.portal.search.solr.server.BasicAuthSolrServerWriter" />
	</bean>
	<bean id="com.liferay.portal.search.solr.SolrSearchEngineImpl" class="com.liferay.portal.kernel.search.BaseSearchEngine">
		<property name="clusteredWrite" value="false" />
		<property name="indexSearcher" ref="com.liferay.portal.search.solr.SolrIndexSearcherImpl" />
		<property name="indexWriter" ref="com.liferay.portal.search.solr.SolrIndexWriterImpl" />
		<property name="luceneBased" value="true" />
		<property name="vendor" value="SOLR" />
	</bean>

	<!-- Configurator -->

Modify the ports if necessary.

The last thing we need to is copy over our Solr Search Engine Plugin's schema.xml and paste it into both of our Solr servers. In /webapps/solr-web/WEB-INF/conf, you should find schema.xml. Copy that, and paste it into Solr_master/example/solr/conf to replace the existing schema.xml. Do the same for Solr_slave.

Start the Solr Servers and Restart Liferay #

To start the Solr servers, navigate to Solr_master/example and run "java -jar start.jar" and do the same for Solr_slave. You should now be able to access the Solr admin panel by hitting http://localhost:8983/solr/admin/ and http://localhost:8984/solr/admin. Start up Liferay. Your Liferay search is now automatically upgraded to use Solr. It is likely, however, that initial searches will come up with nothing: this is because you will need to reindex everything using Solr.

To reindex Liferay, go to the Admin Portlet. Click the Server tab and then click the Execute button next to Reindex all search indexes. It may take a while, but Liferay will begin sending indexing requests to Solr for execution. When the process is complete, Solr will have a complete search index of your site, and will be running independently of all of your Liferay nodes. Installing the plugin to your nodes has the effect of overriding any calls to Lucene for searching. All of Liferay's search boxes will now use Solr as the search index. This is ideal for a clustered environment, as it allows all of your nodes to share one search server and one search index, and this search server operates independently of all of your nodes.

Small Optimization #

One small performance optimization you can make is in solrconfig.xml for each server. In both Solr_master/example/solr/conf/solrconfig.xml and Solr_slave/example/solr/conf/solrconfig.xml, uncomment and modify this <autoCommit> code:

    <!-- Perform a <commit/> automatically under certain conditions:
         maxDocs - number of updates since last commit is greater than this
         maxTime - oldest uncommited update (in ms) is this long ago
         Instead of enabling autoCommit, consider using "commitWithin"
         when adding documents. http://wiki.apache.org/solr/UpdateXmlMessages
    -->
    <autoCommit> 
      <maxDocs>10000</maxDocs>
      <maxTime>10000</maxTime> 
    </autoCommit>

This should help Solr run a little faster.

0 Attachments
104368 Views
Average (3 Votes)
The average rating is 2.66666666666667 stars out of 5.
Comments
Threaded Replies Author Date
Great stuff, but can you say something about... Marcelo Ruiz Camauër August 15, 2008 7:10 AM
Hi Marcelo, Solr fixes some problems we have... Bruno Farache August 15, 2008 4:42 PM
Could you also tell, is there a frontend (a... brian mcsweeney August 17, 2008 11:27 AM
Hi Brian, I don't remember any current plugin... Bruno Farache August 18, 2008 6:03 PM
I not sure if I answered you question... Bruno Farache August 18, 2008 6:22 PM
Hi Bruno, excellent answer. Thanks very much.... brian mcsweeney August 19, 2008 10:29 AM
Hi Brian, No, as this Wiki page explains,... Bruno Farache August 23, 2008 6:06 AM
We have not been able to use even the basic web... Carl Grimm June 8, 2010 11:10 AM
I can see absolutely NO benefits with plugin.... Fuad Efendi June 20, 2009 11:09 PM
Thank you very much for the information, I have... Carlos del Castillo September 30, 2008 4:49 PM
Fixed in... Bruno Farache October 2, 2008 8:38 AM
i have a question, by deploying the plug-in... kuhajeyan gunaratnam November 19, 2008 6:29 AM
Kuhajeyan, you're right, undeploying Solr... Bruno Farache January 14, 2009 8:05 AM
Hello, I'm using Liferay 5.2.2 ,and the solr... Diego Alejandro Palmeira April 28, 2009 2:03 AM
hii team, i using liferay 5.1.1 And I have... taizeq tai June 2, 2009 9:09 PM
btw, what is the evident that the searching is... kuhajeyan gunaratnam November 19, 2008 6:37 AM
Hi, I have same question...if you have... Dhrutika Vyas April 30, 2010 12:41 PM
Hi , I have configured Solr server on my... suresh midde December 23, 2008 12:11 PM
hi guy, i want same advise n help. i use... taizeq tai June 2, 2009 9:05 PM
I can see absolutely NO benefits with plugin.... Fuad Efendi June 20, 2009 11:11 PM
Ok, now I understand why:... Fuad Efendi June 20, 2009 11:22 PM
Hi, Fuad, Your questions are very good...... Artur Linhart September 8, 2009 1:13 AM
Hi Fuad and Artur, good points - multilingual... Jonas Yuan October 21, 2009 5:08 PM
Hello everybody, I just upgraded to Liferay... Carlos del Castillo October 30, 2009 3:06 PM
Is there anyway to get a clustered search... Thomas Kellerer February 2, 2010 2:00 AM
You need clusterd search result, i presume, If... Mayank Awasthi February 19, 2010 5:48 AM
check this post... Madhu Yadav February 28, 2010 2:41 AM
the schema.xml provided do not work with Sol-r... Daniele Segato June 23, 2010 9:14 AM
Apologies if this isn't the correct area... Simon Fox October 25, 2010 7:57 AM
How does one add search capabilities for data... Aaron Daubman October 29, 2010 10:23 AM
Hi all! Is this plugin supported for Liferay 6... David García González November 15, 2011 9:25 AM
Hi, I've made several changes in this portlet.... Salva Tejero December 1, 2011 3:31 AM
Solr integration seems to be broken in Liferay... Henry K February 24, 2012 7:36 AM
Oh, this error is reported in... Henry K February 24, 2012 8:07 AM
The interface for IndexWriter, IndexSearcher &... Victor E March 2, 2012 1:39 AM
A quick question - To ascertain that solr has... Namrata Hangal May 23, 2012 9:01 PM
I have integrated Solr-3.6.0 with Liferay-6.0.6... Rajarshi Chakrabarty June 12, 2012 3:38 AM
What if instead of hard-coding the url, the... Pavel Fomin January 28, 2015 12:14 PM

Great stuff, but can you say something about what the benefits would be? What additional capabilities does it have or how is it better? Will LR move to solr by default in the future?
Posted on 8/15/08 7:10 AM.
Hi Marcelo, Solr fixes some problems we have with clustered portal, think as an replacement of Lucene JDBC.

There is an performance improvement if you have many search requests, you can setup several Solr instances to handle these requests. Liferay will continue to use Lucene as a default impl.
Posted on 8/15/08 4:42 PM in reply to Marcelo Ruiz Camauër.
Could you also tell, is there a frontend (a plugin etc) which will show how to use the solr interface to search the database. If I am understanding things correctly, all the plugin does is sets up solr to just index the data again. However, it doesn't talk about how to use solr from a web page etc. Is there any example of this?

cheers,
Brian
Posted on 8/17/08 11:27 AM in reply to Bruno Farache.
Hi Brian,

I don't remember any current plugin that does searching, but you can take a look at how this is done by looking at some portlets in the core. Try to search for Indexer.java (this is called whenever an entity is added) and for search methods within *LocalServiceImpl.java classes.

Anyways, it's a good idea to have a sample-search-portlet or something like that, thank you for bringing this up.

Besides using the portal to make searches you can also use an web interface that comes with Solr, you just need to go to http://{solr.address}/solr. It has a simple interface but I think it's easy to change it. Solr also provides search results based on a given XSLT file. For more info, take a look at Solr's documentation:


http://wiki.apache.org/solr/XsltResponseWriter?highlight=(xslt)
htt­p://wiki.apache.org/solr/SolrAdminGUI

A good introductory article about Solr:

http://www.ibm.com/developerworks/java/library/j-solr1/
Posted on 8/18/08 6:03 PM in reply to brian mcsweeney.
I not sure if I answered you question correctly, clarifying it more:

Solr is not only used for indexing. The portal picks whichever search plugin is installed at the moment and uses it for both indexing and searching.
Posted on 8/18/08 6:22 PM in reply to Bruno Farache.
Hi Bruno,

excellent answer. Thanks very much. Just to make sure I'm correct, so are you saying if you just install the solr plugin and restart liferay, then all searches in liferay will automatically switch to using solr under the hood?

Definitely I think a sample search portlet that uses it would be great. Also, am I right in thinking that Solr simplifies the querying process, vs straight Lucene for example, as it accepts XSLT as you say.

Anyway, will have a look at your links, thanks very much for your help.

Brian
Posted on 8/19/08 10:29 AM in reply to Bruno Farache.
Hi Brian,

No, as this Wiki page explains, after the plugin is installed you need to go to the Admin porltet and click on "Reindex all search indexes".
Posted on 8/23/08 6:06 AM in reply to brian mcsweeney.
Thank you very much for the information, I have installed solr and the plugin and seems to work fin for the blog entries and wiki, but not the discussions.

I installed Solr with the schema attached to this wiki. and Solr indexed the content from the discussions but when busing the search function on the discussion portlet nothing is displayed.

Any ideas what could be causing this problem?

Thanks!
Posted on 9/30/08 4:49 PM.
Fixed in http://support.liferay.com/browse/LEP-7724
Posted on 10/2/08 8:38 AM in reply to Carlos del Castillo.
i have a question, by deploying the plug-in every search directed to solr? (mm,, probably with admin re-indexing or whatever). How about if i want to revert back to default lucene. just remove the portlet would do? May be i dont quite understand how liferay were able to make a conclusion that, it would direct all its searches just by knowing the solr war is there. can you explain a bit more.

thanks
Posted on 11/19/08 6:29 AM.
btw, what is the evident that the searching is using solr indexes (after having completed all these steps successfully) and how much do i have the control over it?
Posted on 11/19/08 6:37 AM.
Hi ,
I have configured Solr server on my localhost,It is running fine on http://localhost:8983/solr/admin

And I have created a folder by name Solr in my local C Drive and I have copied schema.xml under solr/conf.

I have set SOLR_HOME = c:/solr
and appended -Dsolr.solr.home=%SOLR_HOME% for java_opts

And I have a doubt regarding solr-spring.xml, the port no should be my server (tomcat) running port or the port on which solr is running

<bean id="indexSearcher" class="com.liferay.portal.search.solr.SolrIndexSearcherImpl">
<property name="serverURL" value="[http://localhost:8080/solr/select"] />
</bean>
<bean id="indexWriter" class="com.liferay.portal.search.solr.SolrIndexWriterImpl">
<property name="serverURL" value="[http://localhost:8080/solr/update"] />
</bean>


And I have deployed using plugin installer of application.

"Once the plugin is hot deployed, your Liferay search is automatically upgraded to use Solr."

how does i come to know, the search is now by solr not by lucene and I was getting results in intial searches against this line "It is likely, however, that initial searches will come up with nothing: this is because you will need to reindex everything using Solr."

Finally my lucene folder under liferay , is getting modified by current time and I could not find any index files generating under my solr home.

Was I doing anything wrong, any help highly appreciated.

Regards
Suresh Midde
Posted on 12/23/08 12:11 PM.
Kuhajeyan, you're right, undeploying Solr plugin will default back to Lucene. You would just need to reindex the portal against Lucene.

Look at Solr admin UI to check if your content is being indexed.
Posted on 1/14/09 8:05 AM in reply to kuhajeyan gunaratnam.
Hello, I'm using Liferay 5.2.2 ,and the solr plugin (solr-web-5.2.0.1.war) with solr 1.3.

But when I try to search users, an error occur.
Take a look at this post:
https://www.liferay.com/web/guest/community/forums/-/message_boards/message­/2957400/maximized

Can you help us?

Thank you
Diego
Posted on 4/28/09 2:03 AM in reply to Bruno Farache.
hi guy,
i want same advise n help.

i use liferay 5.1.1

And I have created a folder by name Solr in my local C Drive and I have copied schema.xml under solr/conf.

I have set SOLR_HOME = c:/solr
in fail setenv.bat, i add -Dsolr.solr.home=%SOLR_HOME%

And I have change in solr-spring.xml,

<bean id="indexSearcher" class="com.liferay.portal.search.solr.SolrIndexSearcherImpl">
<property name="serverURL" value="http://localhost:6080/solr/select" />
</bean>
<bean id="indexWriter" class="com.liferay.portal.search.solr.SolrIndexWriterImpl">
<property name="serverURL" value="http://localhost:6080/solr/update" />
</bean>

but after i running liferay..this error appear..
Jun 3, 2009 3:58:01 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-6080
Jun 3, 2009 3:58:01 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:6009
Jun 3, 2009 3:58:01 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31 config=null
Jun 3, 2009 3:58:01 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 32029 ms
03:58:30,765 ERROR [SolrIndexSearcherImpl:79] Error while sending request to Solr
java.lang.NullPointerException
at com.liferay.portal.search.solr.SolrIndexSearcherImpl.subset(SolrIndexSearcherImp­l.java:102)
at com.liferay.portal.search.solr.SolrIndexSearcherImpl.search(SolrIndexSearcherImp­l.java:76)
at com.liferay.portal.search.solr.SolrSearchEngineUtil.search(SolrSearchEngineUtil.­java:78)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doCommandSear­ch(SolrReaderMessageListener.java:92)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doReceive(Sol­rReaderMessageListener.java:75)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.receive(SolrR­eaderMessageListener.java:46)
at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessag­eListener.java:69)
at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestinatio­n.java:59)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:8­85)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
03:58:30,765 ERROR [SolrReaderMessageListener:49] Unable to process message com.liferay.portal.kernel.messaging.Message@1c3a0dd
com.liferay.portal.kernel.sea­rch.SearchException: java.lang.NullPointerException
at com.liferay.portal.search.solr.SolrIndexSearcherImpl.search(SolrIndexSearcherImp­l.java:81)
at com.liferay.portal.search.solr.SolrSearchEngineUtil.search(SolrSearchEngineUtil.­java:78)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doCommandSear­ch(SolrReaderMessageListener.java:92)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doReceive(Sol­rReaderMessageListener.java:75)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.receive(SolrR­eaderMessageListener.java:46)
at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessag­eListener.java:69)
at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestinatio­n.java:59)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:8­85)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
at com.liferay.portal.search.solr.SolrIndexSearcherImpl.subset(SolrIndexSearcherImp­l.java:102)
at com.liferay.portal.search.solr.SolrIndexSearcherImpl.search(SolrIndexSearcherImp­l.java:76)
... 9 more
03:58:40,687 ERROR [IncludeTag:52] Current URL /web/guest/home generates exception: javax.servlet.ServletException: com.liferay.portal.SystemException
: com.liferay.portal.kernel.search.SearchException: com.liferay.portal.kernel.messaging.MessageBusException: No reply received for request: com.lifera
y.portal.kernel.messaging.Message@1c3a0dd
03:58:40,703 ERROR [IncludeTag:52] com.liferay.portal.SystemException: com.liferay.portal.kernel.search.SearchException: com.liferay.portal.kernel.mes
saging.MessageBusException: No reply received for request: com.liferay.portal.kernel.messaging.Message@1c3a0dd
at com.liferay.portal.plugin.PluginPackageUtil._search(PluginPackageUtil.java:1253)­
at com.liferay.portal.plugin.PluginPackageUtil.search(PluginPackageUtil.java:238)

ca­n anyone help me out.
Posted on 6/2/09 9:05 PM.
hii team,

i using liferay 5.1.1

And I have created a folder by name Solr in my local C Drive and I have copied schema.xml under solr/conf.

I have set SOLR_HOME = c:/solr
and add -Dsolr.solr.home=%SOLR_HOME% in fail setenv.bat

And I have change solr-spring.xml like this

<bean id="indexSearcher" class="com.liferay.portal.search.solr.SolrIndexSearcherImpl">
<property name="serverURL" value="http://localhost:6080/solr/select" />
</bean>
<bean id="indexWriter" class="com.liferay.portal.search.solr.SolrIndexWriterImpl">
<property name="serverURL" value="http://localhost:6080/solr/update" />
</bean>

the error appear when i running liferay.

Jun 3, 2009 3:58:01 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-6080
Jun 3, 2009 3:58:01 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:6009
Jun 3, 2009 3:58:01 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31 config=null
Jun 3, 2009 3:58:01 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 32029 ms
03:58:30,765 ERROR [SolrIndexSearcherImpl:79] Error while sending request to Solr
java.lang.NullPointerException
at com.liferay.portal.search.solr.SolrIndexSearcherImpl.subset(SolrIndexSearcherImp­l.java:102)
at com.liferay.portal.search.solr.SolrIndexSearcherImpl.search(SolrIndexSearcherImp­l.java:76)
at com.liferay.portal.search.solr.SolrSearchEngineUtil.search(SolrSearchEngineUtil.­java:78)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doCommandSear­ch(SolrReaderMessageListener.java:92)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doReceive(Sol­rReaderMessageListener.java:75)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.receive(SolrR­eaderMessageListener.java:46)
at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessag­eListener.java:69)
at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestinatio­n.java:59)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:8­85)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
03:58:30,765 ERROR [SolrReaderMessageListener:49] Unable to process message com.liferay.portal.kernel.messaging.Message@1c3a0dd
com.liferay.portal.kernel.sea­rch.SearchException: java.lang.NullPointerException
at com.liferay.portal.search.solr.SolrIndexSearcherImpl.search(SolrIndexSearcherImp­l.java:81)
at com.liferay.portal.search.solr.SolrSearchEngineUtil.search(SolrSearchEngineUtil.­java:78)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doCommandSear­ch(SolrReaderMessageListener.java:92)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doReceive(Sol­rReaderMessageListener.java:75)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.receive(SolrR­eaderMessageListener.java:46)
at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessag­eListener.java:69)
at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestinatio­n.java:59)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:8­85)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
at com.liferay.portal.search.solr.SolrIndexSearcherImpl.subset(SolrIndexSearcherImp­l.java:102)
at com.liferay.portal.search.solr.SolrIndexSearcherImpl.search(SolrIndexSearcherImp­l.java:76)
... 9 more
03:58:40,687 ERROR [IncludeTag:52] Current URL /web/guest/home generates exception: javax.servlet.ServletException: com.liferay.portal.SystemException
: com.liferay.portal.kernel.search.SearchException: com.liferay.portal.kernel.messaging.MessageBusException: No reply received for request: com.lifera
y.portal.kernel.messaging.Message@1c3a0dd
03:58:40,703 ERROR [IncludeTag:52] com.liferay.portal.SystemException: com.liferay.portal.kernel.search.SearchException: com.liferay.portal.kernel.mes
saging.MessageBusException: No reply received for request: com.liferay.portal.kernel.messaging.Message@1c3a0dd
at com.liferay.portal.plugin.PluginPackageUtil._search(PluginPackageUtil.java:1253)­
at com.liferay.portal.plugin.PluginPackageUtil.search(PluginPackageUtil.java:238)

ca­n anyone show me the right way..
Posted on 6/2/09 9:09 PM in reply to Diego Alejandro Palmeira.
I can see absolutely NO benefits with plugin. Liferay is already overengineered with wrappers around Lucene which make extremely hard for instance to use multivalued non-tokenized "Tagged Content" (tags) field for "faceted search" (main selling point of SOLR).
Liferay, even 5.2.4 EE, has even bugs (some 'core' developers don't understand difference between Tokenizer implementations, and even use StringPool.BLANK during retrieval of plain text from Journal XML).

Why do we need _such_ SOLR? Isn't Lucene providing the same functionality?

Wow, you can even use SOLR sharding, and manage thread pools, funny...

Just create web-plugin with rich configuration options, and use SOLR as a completely separate engine (not for indexing Liferay's objects!)
For internal indexing of Liferay's objects plain Lucene is more than enough. Of course SOLR adds better configuration options: for instance you can configure different request handlers, different analyzers for the same field, and more, - but HOW to do it with overengineered Liferay's wrappers, and why do you wrap almost everything including Lucene?

Thanks
Posted on 6/20/09 11:09 PM in reply to Marcelo Ruiz Camauër.
I can see absolutely NO benefits with plugin. Liferay is already overengineered with wrappers around Lucene which make extremely hard for instance to use multivalued non-tokenized "Tagged Content" (tags) field for "faceted search" (main selling point of SOLR).
Liferay, even 5.2.4 EE, has even bugs (some 'core' developers don't understand difference between Tokenizer implementations, and even use StringPool.BLANK during retrieval of plain text from Journal XML).

Why do we need _such_ SOLR? Isn't Lucene providing the same functionality?

Wow, you can even use SOLR sharding, and manage thread pools, funny...

Just create web-plugin with rich configuration options, and use SOLR as a completely separate engine (not for indexing Liferay's objects!)
For internal indexing of Liferay's objects plain Lucene is more than enough. Of course SOLR adds better configuration options: for instance you can configure different request handlers, different analyzers for the same field, and more, - but HOW to do it with overengineered Liferay's wrappers, and why do you wrap almost everything including Lucene?

Thanks
Posted on 6/20/09 11:11 PM.
Ok, now I understand why:
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Pluggable+Enterp­rise+Search

- yes, separate Search Engine from Liferay Container is the main reason, and SOLR plugin is first and easiest step.

But again, instead of something 'abstract' let's do real staff, such as using _the_full_power_ of SOLR instead of focusing on minimal subset of features supported by any imaginable engine...

How do you handle multilingual support during indexing, for instance? Do you use language analyzers, word stemmers, synonym dictionaries for different languages? Do you provide SOLR with language attribute of the document? Do you 'analyze' user's query, and how? Stop-wrods for French?
Posted on 6/20/09 11:22 PM in reply to Fuad Efendi.
Hi, Fuad,

Your questions are very good... Bruno, can You answer them, please?

with best regards, Artur
Posted on 9/8/09 1:13 AM in reply to Fuad Efendi.
Hi Fuad and Artur, good points - multilingual support? where is it? Can anyone answer them? Jonas
Posted on 10/21/09 5:08 PM in reply to Artur Linhart.
Hello everybody, I just upgraded to Liferay 5.2.3. I installed the solr plugin 5.2.0.1 (backend solr is 1.3.0) and reindexed liferay. Everything went fine with the reindexing but when I try to do a search I get the following error:

21:55:29,229 ERROR [SolrIndexSearcherImpl:97] Error while sending request to Solr
java.lang.NullPointerException
at org.apache.solr.client.solrj.SolrQuery.toSortString(SolrQuery.java:497)
at org.apache.solr.client.solrj.SolrQuery.addSortField(SolrQuery.java:293)
at com.liferay.portal.search.solr.SolrIndexSearcherImpl.search(SolrIndexSearcherImp­l.java:88)
at com.liferay.portal.search.solr.SolrSearchEngineUtil.search(SolrSearchEngineUtil.­java:79)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doCommandSear­ch(SolrReaderMessageListener.java:86)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doReceive(Sol­rReaderMessageListener.java:68)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.receive(SolrR­eaderMessageListener.java:44)
at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessag­eListener.java:70)
at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestinatio­n.java:60)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:8­86)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
­at java.lang.Thread.run(Thread.java:619)
21:55:29,230 ERROR [SolrReaderMessageListener:47] Unable to process message {destination=liferay/search_reader, responseDestination=liferay/search_reader/response, responseId=a6a02f6d-b7e1-4faf-bd8a-557da69665e5, payload={command=SEARCH, companyId=10109, id=null, doc=null, query=+(+portletId:33) +(userName:test title:test content:test tagsEntries:test), sorts=[Lcom.liferay.portal.kernel.search.Sort;@1055900a, start=0, end=20}, values=null}
com.liferay.portal.kernel.search.SearchException: java.lang.NullPointerException
at com.liferay.portal.search.solr.SolrIndexSearcherImpl.search(SolrIndexSearcherImp­l.java:99)
at com.liferay.portal.search.solr.SolrSearchEngineUtil.search(SolrSearchEngineUtil.­java:79)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doCommandSear­ch(SolrReaderMessageListener.java:86)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doReceive(Sol­rReaderMessageListener.java:68)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.receive(SolrR­eaderMessageListener.java:44)
at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessag­eListener.java:70)
at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestinatio­n.java:60)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:8­86)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
­at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
at org.apache.solr.client.solrj.SolrQuery.toSortString(SolrQuery.java:497)
at org.apache.solr.client.solrj.SolrQuery.addSortField(SolrQuery.java:293)
at com.liferay.portal.search.solr.SolrIndexSearcherImpl.search(SolrIndexSearcherImp­l.java:88)
... 9 more
21:55:39,239 ERROR [jsp:1109] com.liferay.portlet.blogs.util.BlogsOpenSearchImpl com.liferay.portal.SystemException: com.liferay.portal.kernel.search.SearchException: com.liferay.portal.kernel.messaging.MessageBusException: No reply received for message: {destination=liferay/search_reader, responseDestination=liferay/search_reader/response, responseId=a6a02f6d-b7e1-4faf-bd8a-557da69665e5, payload={command=SEARCH, companyId=10109, id=null, doc=null, query=+(+portletId:33) +(userName:test title:test content:test tagsEntries:test), sorts=[Lcom.liferay.portal.kernel.search.Sort;@1055900a, start=0, end=20}, values=null}

I'm using the global search tool. It only finds users and web content. But no blogs or wiki pages. (The query should return blog entries and wiki pages).


On the solr server side I only see this in the logs:

INFO: [] webapp=/solr path=/select params={fl=score&sort=displayDate+desc&start=0&q=%2B(%2BportletId:15)+%2B(title:­test+content:test+description:test+tagsCategories:test+tagsEntries:test+type:tes­t)&wt=javabin&rows=5&version=2.2} hits=9 status=0 QTime=1


Any ideas on how to fix this? Thanks
Posted on 10/30/09 3:06 PM.
Is there anyway to get a clustered search *without* using Solr?

We do not need a high-performance search, but we do need a cluster. But it seems Lucene/JDBC cannot be used....
Posted on 2/2/10 2:00 AM in reply to Carlos del Castillo.
You need clusterd search result, i presume, If yes go for http://project.carrot2.org

If its a clustered search indexes then Solr is best you have.
Posted on 2/19/10 5:48 AM in reply to Thomas Kellerer.
check this post http://www.liferay.com/community/forums/-/message_boards/message/4662949
Posted on 2/28/10 2:41 AM in reply to Carlos del Castillo.
Hi,
I have same question...if you have answer..please reply..

How can we make sure its using solr search?
I am getting liferay serach results in solr admin console...but not sure how can sure thta liferay is using solr?
Posted on 4/30/10 12:41 PM in reply to kuhajeyan gunaratnam.
We have not been able to use even the basic web interface with Solr because the results do have not a URL to get back to the document or page in Liferay.

How do we get SolrIndexWriterImpl to send URL for the given document over to Solr at index time?
Posted on 6/8/10 11:10 AM in reply to Bruno Farache.
the schema.xml provided do not work with Sol-r 1.4.0 and the wiki page do not tell us which version of Sol-r we should use.

I get this error when starting the sol-r server with your schema.xml:

SEVERE: org.apache.solr.common.SolrException: no field name specified in query and no defaultSearchField defined in schema.xml

I've opened a thread in the forum:

http://www.liferay.com/community/forums/-/message_boards/message/5149946
Posted on 6/23/10 9:14 AM.
Simon Fox
Apologies if this isn't the correct area (please let me know!), but am looking into the situation where (when doing a "reindex all search indexes" inside liferay) the solr plugin creates a solr index of liferay pages which includes hidden pages. Can you advise on how to stop the hidden pages being included?

Thanks, Simon
Posted on 10/25/10 7:57 AM.
How does one add search capabilities for data added to the database through a custom Portlet (or other not-currently-indexed portlets)?
This is for Solr 1.4.1 with Liferay EE 6.0.10.1
Posted on 10/29/10 10:23 AM.
Hi all!

Is this plugin supported for Liferay 6 EE?
Posted on 11/15/11 9:25 AM in reply to Aaron Daubman.
Hi, I've made several changes in this portlet. I needed suggestions for SOLR.
I've created a new implementation of Hits SolrHitsImpl and I've created a new attribute named "String[] suggestions; "
In the class SolrIndexSearcherImpl I've include this code

if(queryResponse.getSpellCheckResponse() != null){
List<Suggestion> suggestions = queryResponse.getSpellCheckResponse().getSuggestions();

List<String> sugerencias = new ArrayList<String>();
if(suggestions != null){
for(Suggestion sug: suggestions){
for(String s1 : sug.getSuggestions()){
if(!sugerencias.contains(s1)){
­ sugerencias.add(s1);
}
}
­ }
}
String[] suggestFinal = new String[sugerencias.size()];
subset.setSuggestions(sugerencias.toArray(sugge­stFinal));
}

I hope that it 's usefull
Posted on 12/1/11 3:31 AM in reply to David García González.
Solr integration seems to be broken in Liferay 6.1 GA 1. I get an error on deployment, and the context never loads.

INFO: Deploying web application directory /home/henryk/workspace/bundles/liferay-portal-6.1.0-ce-ga1/tomcat-7.0.23/webapps­/solr-web
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
context: /solr-web
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@73995d80
] whereas object of type
log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [WebappClassLoader
context:
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@73995d80
].
log4j:ERROR­ Could not instantiate appender named "CONSOLE".
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/henryk/workspace/bundles/liferay-portal-6.1.0-ce-ga1/tomcat-7.0.­23/temp/7-solr-web/WEB-INF/lib/slf4j-jdk14.jar!/org/slf4j/impl/StaticLoggerBinde­r.class]
SLF4J: Found binding in [jar:file:/home/henryk/workspace/bundles/liferay-portal-6.1.0-ce-ga1/tomcat-7.0.­23/temp/7-solr-web/WEB-INF/lib/util-java.jar!/org/slf4j/impl/StaticLoggerBinder.­class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
15:32:05,549 INFO [PluginPackageUtil:1099] Reading plugin package for solr-web
Loading file:/home/henryk/workspace/bundles/liferay-portal-6.1.0-ce-ga1/tomcat-7.0.23/te­mp/7-solr-web/WEB-INF/classes/portlet.properties
Posted on 2/24/12 7:36 AM.
Oh, this error is reported in http://issues.liferay.com/browse/LPS-9376 . Jonas's first post fixes the problem.
Posted on 2/24/12 8:07 AM in reply to Henry K.
The interface for IndexWriter, IndexSearcher & SearchEngine changed in LF 6.1.
So it still wouldn't work after fixing the log4j.
Anyone had updated this for LF 6.1?
Posted on 3/2/12 1:39 AM in reply to Henry K.
A quick question -
To ascertain that solr has been used for indexing, is it necessary to see the SolrIndexer (if there is anything like that?) in liferay's console instead of LuceneIndexer?
I'm trying to integrate solr 1.4.1 with liferay 6.1 on jboss 5.1
Posted on 5/23/12 9:01 PM in reply to Victor E.
I have integrated Solr-3.6.0 with Liferay-6.0.6 using solr-web-plugin-1.1.war. NOw i wanted to do faceted search. I have downloaded community faceted-search-1.1.war and implemented it. But its not working properly. Can anyone help me out with the faceted search in liferay?
Posted on 6/12/12 3:38 AM.
What if instead of hard-coding the url, the solr-spring.xml is modified to use a property from portal-ext.properties? If the spring configuration must be modified anyway it might as well be enhanced in an environment independent way so the plugin is modified only once and then the solr url is controled via portal-ext.properties in different environments.

{code}
<beans
default-destroy-method="destroy"
default-init-method="­afterPropertiesSet"
xmlns="http://www.springframework.org/schema/beans"
xmlns:ut­il="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/200­1/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/conte­xt"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"
>
<!-- This element activates the replacement of ${...} placeholders, resolved against the specified properties file -->
<context:property-placeholder location="file:${liferay.home}/portal-ext.properties"/>

<bean class="com.liferay.portal.spring.context.PortletBeanFactoryPostProcessor" />

<!-- Solr search engine client -->

<bean id="com.liferay.portal.search.solr.server.BasicAuthSolrServer" class="com.liferay.portal.search.solr.server.BasicAuthSolrServer">
<property name="httpRequestInterceptors">
<list>
<bean class="com.liferay.portal.search.solr.interceptor.PreemptiveAuthInterceptor" />
</list>
</property>
<property name="url" value="${com.liferay.portal.solr.server.url}" />
</bean>
{code}

If property com.liferay.portal.solr.server.url is not defined in portal-ext.properties, the following error should be expected:

Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'com.liferay.portal.search.solr.server.BasicAuthSolrServer' defined in ServletContext resource [/WEB-INF/classes/META-INF/solr-spring.xml]: Could not resolve placeholder 'com.liferay.portal.solr.server.url'
Posted on 1/28/15 12:14 PM.