Free Sample
+ Collection

Apache Solr PHP Integration

Jayant Kumar

For PHP developers who need to integrate a search facility into their applications, this guide is your passport to success. It takes you step by step through the great features of Apache Solr and how to implement them.
RRP $20.99
RRP $34.99
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781782164920
Paperback118 pages

About This Book

  • Understand the tools that can be used to communicate between PHP and Solr, and how they work internally
  • Explore the essential search functions of Solr such as sorting, boosting, faceting, and highlighting using your PHP code
  • Take a look at some advanced features of Solr such as spell checking, grouping, and auto complete with implementations using PHP code

Who This Book Is For

If you are a developer who knows PHP and is interested in integrating search into your applications, this is the book for you. No advanced knowledge of Solr is required. Very basic knowledge of system commands and the command-line interface on both Linux and Windows is required. You should also be familiar with the concept of Web servers.

Table of Contents

Chapter 1: Installing and Integrating Solr and PHP
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
Chapter 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
Chapter 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
Chapter 4: Advanced Queries – Filter Queries and Faceting
Filter queries and their benefits
Executing filter queries
Creating filter query configuration
Facet by field
Facet by query
Facet by range
Facet by pivot
Chapter 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
Chapter 6: Debug and Stats Component
Solr relevance ranking
Executing debug through PHP code
Running debug on Solr interface
The stats component
Chapter 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
Chapter 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

What You Will Learn

  • Install Solr and integrate it with PHP
  • Insert, update, and delete documents from the Solr index using PHP
  • Perform select queries using the dismax and edismax query modes
  • Sort, boost, and re-use select queries using PHP
  • Employ faceting and result highlighting
  • Debug and fine-tune Solr search queries for relevance
  • Implement the spell checker and auto complete features using Solr and PHP
  • Search for documents similar to a particular document and Retrieve index stats using PHP
  • Deploy distributed searching using sharing and load-balancing of Solr queries

In Detail

The Search tool is a very powerful for any website. No matter what type of website, the search tool helps visitors find what they are looking for using key words and narrow down the results using facets. Solr is the popular, blazing fast, open source enterprise search platform from the Apache Lucene project. It is highly scalable, providing distributed search and index replication, and it powers the search and navigation features of many of the world's largest websites.

This book is a practical, hands-on, end-to-end guide that provides you with all the tools required to build a fully-featured search application using Apache Solr and PHP. The book contains practical examples and step-by-step instructions.

Starting off with the basics of installing Apache Solr and integrating it with Php, the book then proceeds to explore the features provided by Solr to improve searches using Php. You will learn how to build and maintain a Solr index using Php, discover the query modes available with Solr, and how to use them to tune the Solr queries to retrieve relevant results. You will look at how to build and use facets in your search, how to tune and use fast result highlighting, and how to build a spell check and auto complete feature using Solr. You will finish by learning some of the advanced concepts required to runa large-scale enterprise level search infrastructure.


Read More