PHP Sphinx API extension for faceted search.
Switch branches/tags
Nothing to show
Pull request Compare This branch is 4 commits behind gigablah:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

FSphinx is a PHP port of the [fSphinx] 1 Python library, which extends the Sphinx API to easily perform faceted search.

What's faceted search?

Think of "filtering", "refining" or "drilling down". For example, when searching through a database of movie titles, you could get a list of clickable refinement options such as actors, directors, genre and year of release. As opposed to static hierarchical navigation, these options are calculated as you search so you don't end up following paths that return zero results.

How do I use this?

$fsphinx = new FSphinxClient();
$fsphinx->SetServer(SPHINX_HOST, SPHINX_PORT);
$fsphinx->AttachQueryParser(new MultiFieldQuery());
$fsphinx->AttachFacets(new Facet('actor'), new Facet('director'), new Facet('year'));
$results = $fsphinx->Query('action');
foreach ($results['facets'] as $facet) var_dump($facet);

To learn more, please refer to the [tutorial] 2 or the [documentation] 3.


  • PHP 5.3+ (namespaces, anonymous functions)
  • Sphinx 1.10+ (string attributes)

For questions and suggestions, please email Chris Heng (hengkuanyen at gmail dot com).