PacktLib: Apache Solr PHP Integration

Apache Solr PHP Integration


About the Author

About the Reviewers


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


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


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


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


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


Debug and Stats Component

Solr relevance ranking

Executing debug through PHP code

Running debug on Solr interface

The stats component


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


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