Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Apache Solr PHP Integration

You're reading from   Apache Solr PHP Integration Build a fully-featured and scalable search application using PHP to unlock the search functions provided by Solr with this book and ebook.

Arrow left icon
Product type Paperback
Published in Nov 2013
Publisher Packt
ISBN-13 9781782164920
Length 118 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Jayant Kumar Jayant Kumar
Author Profile Icon Jayant Kumar
Jayant Kumar
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Apache Solr PHP Integration
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Installing and Integrating Solr and PHP FREE CHAPTER 2. Inserting, Updating, and Deleting Documents from Solr 3. Select Query on Solr and Query Modes (DisMax/eDisMax) 4. Advanced Queries – Filter Queries and Faceting 5. Highlighting Results Using PHP and Solr 6. Debug and Stats Component 7. Spell Check in Solr 8. Advanced Solr – Grouping, the MoreLikeThis Query, and Distributed Search Index

Configuring Tomcat to run Solr


The web server jetty used by default Solr is meant for development purposes only. For production environment, we would want Solr to run as a part of a more convenient setup involving a more reliable web server. Solr can be configured to run on any J2EE container such as IBM Websphere or JBoss or any other server. Apache Tomcat is the most commonly used server. Let us see how to set up Solr as a part of Apache Tomcat web server. We have Apache Tomcat installed on our Windows or Linux environment.

To run Solr as a part of Apache Tomcat web server, you need to create a context for /solr in the configuration. The following solr.xml file needs to be put at the appropriate location in Windows and Linux inside the Tomcat configuration folder at <tomcat_home>/conf/Catalina/localhost.

<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="/home/jayant/solr-4.3.1/example/webapps/solr.war" >
<Environment name="solr/home" type="java.lang.String" value="/home/jayant/solr-4.3.1/example/solr" override="true" />
</Context>

Change docBase to <solr_path>/example/webapps/solr.war and the value attribute in Environment to <solr_path>/example/solr. The environment named solr/home tells Tomcat the location where Solr configuration files are to be found. In addition to this, let us change the configuration of Solr in the <solr_path>/example/solr/solr.xml file. Search for hostPort and change it to match Tomcat's port 8080. Similarly search for hostContext and change it to solr.

Note

Windows users, use \ instead of / in your configuration XML files for path variables. Do not change the / in solr/home.

Restart your Tomcat server and you should be able to go to the following URL to see Solr working along with Tomcat:

http://localhost:8080/solr/

Tip

If you see an error "404 not found" on the preceding URL, it may be because of some libraries of Solr that Tomcat is not able to find. You can check the exact error in Tomcat error logs in the <tomcat_home>/logs/catalina.out folder. To resolve the missing library issue, copy all JAR files from the <solr_home>/example/lib/ext to <tomcat_home>/lib folder.

You can also enable advanced logging in your Tomcat logs by copying the log4j.properties file from the <solr_home>/example/resources folder to your <tomcat_home>/lib folder.

You have been reading a chapter from
Apache Solr PHP Integration
Published in: Nov 2013
Publisher: Packt
ISBN-13: 9781782164920
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image