O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Apache Solr PHP Integration

Book Description

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.

  • 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

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.

Table of Contents

  1. Apache Solr PHP Integration
    1. Table of Contents
    2. Apache Solr PHP Integration
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Installing and Integrating Solr and PHP
      1. Solr
      2. Installing Solr
      3. Configuring Tomcat to run Solr
      4. Executing a ping query on Solr using PHP
      5. Libraries available for PHP-Solr integration
      6. Installing Solarium
      7. Executing ping queries on Solr using PHP and Solarium library
      8. More about endpoints
      9. Checking Solr query logs
      10. Solarium adapters
      11. Summary
    9. 2. Inserting, Updating, and Deleting Documents from Solr
      1. The Solr schema
      2. Adding sample documents to the Solr index
      3. Using PHP to add documents to the Solr index
      4. Updating documents in Solr using PHP
      5. Deleting documents in Solr using PHP
      6. Commit, rollback, and index optimization
      7. Summary
    10. 3. Select Query on Solr and Query Modes (DisMax/eDisMax)
      1. Creating a basic select query with sorting and return fields
      2. Running a query using select configuration
      3. Re-using queries
      4. DisMax and eDisMax query modes
      5. Executing queries using DisMax and eDisMax
      6. Date boosting in an eDisMax query
      7. Advanced query parameters
      8. Summary
    11. 4. Advanced Queries – Filter Queries and Faceting
      1. Filter queries and their benefits
      2. Executing filter queries
      3. Creating filter query configuration
      4. Faceting
      5. Facet by field
      6. Facet by query
      7. Facet by range
      8. Facet by pivot
      9. Summary
    12. 5. Highlighting Results Using PHP and Solr
      1. Solr highlighting configuration
      2. Highlighting in Solr using PHP and Solarium
      3. Using different highlighting tags for different fields
      4. Highlighting using the fast vector highlighter
      5. Summary
    13. 6. Debug and Stats Component
      1. Solr relevance ranking
      2. Executing debug through PHP code
      3. Running debug on Solr interface
      4. The stats component
      5. Summary
    14. 7. Spell Check in Solr
      1. Solr configuration for spell check
      2. Spell checker implementations available with Solr
      3. Running a spell check query using PHP
      4. Implementing the autocomplete feature using PHP and Solr
      5. Summary
    15. 8. Advanced Solr – Grouping, the MoreLikeThis Query, and Distributed Search
      1. Grouping results by fields
      2. Grouping results by queries
      3. Running more like this query using PHP
      4. More like this tuning parameters
      5. Distributed search
      6. Setting up a distributed search
      7. Executing a distributed search using PHP
      8. Setting up Solr master-slave
      9. Load balancing Solr queries using PHP
      10. Summary
    16. Index