« Voltar para 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 Anexos
65162 Visualizações
Média (3 Votos)
A média da avaliação é 2.66666666666667 estrelas de 5.
Comentários
Respostas do tópico Autor Data
Great stuff, but can you say something about... Marcelo Ruiz Camauër 15 de Agosto de 2008 07:10
Hi Marcelo, Solr fixes some problems we have... Bruno Farache 15 de Agosto de 2008 16:42
Could you also tell, is there a frontend (a... brian mcsweeney 17 de Agosto de 2008 11:27
Hi Brian, I don't remember any current plugin... Bruno Farache 18 de Agosto de 2008 18:03
I not sure if I answered you question... Bruno Farache 18 de Agosto de 2008 18:22
Hi Bruno, excellent answer. Thanks very much.... brian mcsweeney 19 de Agosto de 2008 10:29
Hi Brian, No, as this Wiki page explains,... Bruno Farache 23 de Agosto de 2008 06:06
We have not been able to use even the basic web... Carl Grimm 8 de Junho de 2010 11:10
I can see absolutely NO benefits with plugin.... Fuad Efendi 20 de Junho de 2009 23:09
Thank you very much for the information, I have... Carlos del Castillo 30 de Setembro de 2008 16:49
Fixed in... Bruno Farache 2 de Outubro de 2008 08:38
i have a question, by deploying the plug-in... kuhajeyan gunaratnam 19 de Novembro de 2008 06:29
Kuhajeyan, you're right, undeploying Solr... Bruno Farache 14 de Janeiro de 2009 08:05
Hello, I'm using Liferay 5.2.2 ,and the solr... Diego Alejandro Palmeira 28 de Abril de 2009 02:03
hii team, i using liferay 5.1.1 And I have... taizeq tai 2 de Junho de 2009 21:09
btw, what is the evident that the searching is... kuhajeyan gunaratnam 19 de Novembro de 2008 06:37
Hi, I have same question...if you have... Dhrutika Vyas 30 de Abril de 2010 12:41
Hi , I have configured Solr server on my... suresh midde 23 de Dezembro de 2008 12:11
hi guy, i want same advise n help. i use... taizeq tai 2 de Junho de 2009 21:05
I can see absolutely NO benefits with plugin.... Fuad Efendi 20 de Junho de 2009 23:11
Ok, now I understand why:... Fuad Efendi 20 de Junho de 2009 23:22
Hi, Fuad, Your questions are very good...... Artur Linhart 8 de Setembro de 2009 01:13
Hi Fuad and Artur, good points - multilingual... Jonas Yuan 21 de Outubro de 2009 17:08
Hello everybody, I just upgraded to Liferay... Carlos del Castillo 30 de Outubro de 2009 15:06
Is there anyway to get a clustered search... Thomas Kellerer 2 de Fevereiro de 2010 02:00
You need clusterd search result, i presume, If... Mayank Awasthi 19 de Fevereiro de 2010 05:48
check this post... Madhu Yadav 28 de Fevereiro de 2010 02:41
the schema.xml provided do not work with Sol-r... Daniele Segato 23 de Junho de 2010 09:14
Apologies if this isn't the correct area... Simon Fox 25 de Outubro de 2010 07:57
How does one add search capabilities for data... Aaron Daubman 29 de Outubro de 2010 10:23
Hi all! Is this plugin supported for Liferay 6... David García González 15 de Novembro de 2011 09:25
Hi, I've made several changes in this portlet.... Salva Tejero 1 de Dezembro de 2011 03:31
Solr integration seems to be broken in Liferay... Henry K 24 de Fevereiro de 2012 07:36
Oh, this error is reported in... Henry K 24 de Fevereiro de 2012 08:07
The interface for IndexWriter, IndexSearcher &... Victor E 2 de Março de 2012 01:39
A quick question - To ascertain that solr has... Namrata Hangal 23 de Maio de 2012 21:01
I have integrated Solr-3.6.0 with Liferay-6.0.6... Rajarshi Chakrabarty 12 de Junho de 2012 03:38

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?
Postado em 15/08/08 07:10.
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.
Postado em 15/08/08 16:42 em resposta a 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
Postado em 17/08/08 11:27 em resposta a 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/
Postado em 18/08/08 18:03 em resposta a 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.
Postado em 18/08/08 18:22 em resposta a 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
Postado em 19/08/08 10:29 em resposta a 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".
Postado em 23/08/08 06:06 em resposta a 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!
Postado em 30/09/08 16:49.
Fixed in http://support.liferay.com/browse/LEP-7724
Postado em 02/10/08 08:38 em resposta a 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
Postado em 19/11/08 06:29.
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?
Postado em 19/11/08 06:37.
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
Postado em 23/12/08 12:11.
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.
Postado em 14/01/09 08:05 em resposta a 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
Postado em 28/04/09 02:03 em resposta a 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.
Postado em 02/06/09 21:05.
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..
Postado em 02/06/09 21:09 em resposta a 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
Postado em 20/06/09 23:09 em resposta a 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
Postado em 20/06/09 23:11.
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?
Postado em 20/06/09 23:22 em resposta a Fuad Efendi.
Hi, Fuad,

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

with best regards, Artur
Postado em 08/09/09 01:13 em resposta a Fuad Efendi.
Hi Fuad and Artur, good points - multilingual support? where is it? Can anyone answer them? Jonas
Postado em 21/10/09 17:08 em resposta a 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
Postado em 30/10/09 15:06.
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....
Postado em 02/02/10 02:00 em resposta a 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.
Postado em 19/02/10 05:48 em resposta a Thomas Kellerer.
check this post http://www.liferay.com/community/forums/-/message_boards/message/4662949
Postado em 28/02/10 02:41 em resposta a 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?
Postado em 30/04/10 12:41 em resposta a 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?
Postado em 08/06/10 11:10 em resposta a 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
Postado em 23/06/10 09:14.
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
Postado em 25/10/10 07:57.
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
Postado em 29/10/10 10:23.
Hi all!

Is this plugin supported for Liferay 6 EE?
Postado em 15/11/11 09:25 em resposta a 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
Postado em 01/12/11 03:31 em resposta a 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
Postado em 24/02/12 07:36.
Oh, this error is reported in http://issues.liferay.com/browse/LPS-9376 . Jonas's first post fixes the problem.
Postado em 24/02/12 08:07 em resposta a 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?
Postado em 02/03/12 01:39 em resposta a 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
Postado em 23/05/12 21:01 em resposta a 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?
Postado em 12/06/12 03:38.