Apache Solr PHP Integration
Table of Contents
Apache Solr PHP Integration
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Installing and Integrating Solr and PHP
Solr
Installing Solr
Configuring Tomcat to run Solr
Executing a ping query on Solr using PHP
Libraries available for PHP-Solr integration
Installing Solarium
Executing ping queries on Solr using PHP and Solarium library
More about endpoints
Checking Solr query logs
Solarium adapters
Summary
2. Inserting, Updating, and Deleting Documents from Solr
The Solr schema
Adding sample documents to the Solr index
Using PHP to add documents to the Solr index
Updating documents in Solr using PHP
Deleting documents in Solr using PHP
Commit, rollback, and index optimization
Summary
3. Select Query on Solr and Query Modes (DisMax/eDisMax)
Creating a basic select query with sorting and return fields
Running a query using select configuration
Re-using queries
DisMax and eDisMax query modes
Executing queries using DisMax and eDisMax
Date boosting in an eDisMax query
Advanced query parameters
Summary
4. Advanced Queries â Filter Queries and Faceting
Filter queries and their benefits
Executing filter queries
Creating filter query configuration
Faceting
Facet by field
Facet by query
Facet by range
Facet by pivot
Summary
5. Highlighting Results Using PHP and Solr
Solr highlighting configuration
Highlighting in Solr using PHP and Solarium
Using different highlighting tags for different fields
Highlighting using the fast vector highlighter
Summary
6. Debug and Stats Component
Solr relevance ranking
Executing debug through PHP code
Running debug on Solr interface
The stats component
Summary
7. Spell Check in Solr
Solr configuration for spell check
Spell checker implementations available with Solr
Running a spell check query using PHP
Implementing the autocomplete feature using PHP and Solr
Summary
8. Advanced Solr â Grouping, the MoreLikeThis Query, and Distributed Search
Grouping results by fields
Grouping results by queries
Running more like this query using PHP
More like this tuning parameters
Distributed search
Setting up a distributed search
Executing a distributed search using PHP
Setting up Solr master-slave
Load balancing Solr queries using PHP
Summary
Index
Apache Solr PHP Integration
Copyright © 2013 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: November 2013
Production Reference: 1181113
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78216-492-0
www.packtpub.com
Author
Jayant Kumar
Reviewers
Renoir Boulanger
Ruben Teijeiro
Acquisition Editor
Luke Presland
Commisioning Editor
Amit Ghodake
Technical Editors
Sharvari H. Baet
Nadeem Bagban
Project Coordinator
Suraj Bist
Proofreader
Ting Baker
Indexer
Monica Ajmera Mehta
Production Coordinator
Melwyn D'sa
Cover Work
Melwyn D'sa
Jayant Kumar is an experienced software professional and a Bachelor of Engineering in Computer Science, with more than 12 years' of experience in architecting and developing large-scale web applications.
Jayant is an expert on search technologies and PHP and has been working with Lucene and Solr for more than 10 years now. He has been the key person responsible for introducing Lucene as a search engine in www.naukri.com, the most successful job portal in India.
Jayant has played many different important roles throughout his career, including software developer, team leader, project manager, and architect, but his primary focus has been on building scalable solutions on the web. Currently, he is associated with the digital division of HT Media as the Chief Architect responsible for the job site www.shine.com.
Jayant is an avid blogger and his blog can be visited at http://jayant7k.blogspot.in. His LinkedIn profile is available at http://www.linkedin.com/in/jayantkumar.
Renoir Boulanger is an application developer fascinated with web standards. He has been developing websites and web applications in PHP for over 10 years. His experience includes server management and web development for several communications agencies in the province of Quebec. He has created web integration libraries, and participated in the development of various specialized web applications, some of which were for big-name clients such as the W3C, Ericsson, Telefilm Canada, and the Union des Artistes du Québec.
Renoir's involvement in the W3C is as a member of developer relations and system teams, mainly contributing to the WebPlatform Docs (http://webplatform.org/) project to maintain the site stability, improve the site feature...