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.
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
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/
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.
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
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".
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
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.
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
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..
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
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?
Hi, Fuad, Your questions are very good... Bruno, can You answer them, please? with best regards, Artur
Hi Fuad and Artur, good points - multilingual support? where is it? Can anyone answer them? Jonas
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....
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.
check this post http://www.liferay.com/community/forums/-/message_boards/message/4662949
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?
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?
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.