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->SetDefaultIndex('movies'); $fsphinx->SetMatchMode(SPH_MATCH_EXTENDED2); $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);
- PHP 5.3+ (namespaces, anonymous functions)
- Sphinx 1.10+ (string attributes)
For questions and suggestions, please email Chris Heng (hengkuanyen at gmail dot com).