Chapter . Getting Started with Sphinx

In this chapter, we will cover basic installation, configuration, and maintenance of Sphinx. Don’t be fooled by the adjective “basic” and skip the chapter. By “basic,” I don’t mean something simple to the point of being obvious—instead, I mean features that literally everyone uses.

Sphinx, by default, uses MySQL as its source for data and assumes that you have both MySQL and the MySQL development libraries installed. You can certainly run Sphinx with some other relational database or data source, but MySQL is very popular and this chapter is based on it for convenience. There are at least half a dozen easy ways to install MySQL on most systems, so this chapter won’t cover that task. I’ll also assume you know some basic SQL.

Workflow Overview

Installation, configuration, and usage are all pieces of a larger picture. A complete search solution consists of four key components:

Your client program

This accepts the user’s search string (or builds a search string through its own criteria), sends a query to searchd, and displays the results.

A data source

This stores your data and is queried by the indexer program. Most Sphinx sites use MySQL or another SQL server for storage. But that’s not a fundamental requirement—Sphinx can work just as well with non-SQL data sources. And we’ll see, in the following section, that you can populate Sphinx’s index from an application instead of a fixed source such as a database.


This program fetches the data from the ...

Get Introduction to Search with Sphinx now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.