Download the PHP package scalia/sphinxsearch without Composer
On this page you can find all versions of the php package scalia/sphinxsearch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download scalia/sphinxsearch
More information about scalia/sphinxsearch
Files in scalia/sphinxsearch
Package sphinxsearch
Short Description Laravel package to query Sphinxsearch
License Apache-2.0
Homepage http://github.com/scalia/sphinxsearch
Informations about the package sphinxsearch
Sphinx Search
Sphinx Search is a package for Laravel 4 which queries Sphinxsearch and integrates with Eloquent.
Installation
Add scalia/sphinxsearch
to composer.json
.
"scalia/sphinxsearch": "dev-master"
Run composer update
to pull down the latest version of Sphinx Search.
Now open up app/config/app.php
and add the service provider to your providers
array.
Now add the alias.
Configuration
To use Sphinx Search, you need to configure your indexes and what model it should query. To do so, publish the configuration into your app.
This will create the file app/config/packages/scalia/sphinxsearch/config.php
. Modify as needed the host and port, and configure the indexes, binding them to a table and id column.
Or disable the model querying to just get a list of result id's.
Usage
Basic query (raw sphinx results)
Basic query (with Eloquent)
Query another Sphinx index with limit and filters.
Query with match and sort type specified.
Query and sort with geo-distant searching.
Integration with Eloquent
This package integrates well with Eloquent. You can change index configuration with modelname
to get Eloquent's Collection (Illuminate\Database\Eloquent\Collection) as a result of SphinxSearch::search
.
Eager loading with Eloquent is the same an one would expect:
More on eager loading: http://laravel.com/docs/eloquent#eager-loading
Paging results in Laravel 4 (with caching)
Paging results in Laravel 4 (without caching)
And, in your view after you finish displaying rows,
Searching through multiple Sphinx indexes (main/delta)
It is a common strategy to utilize the main+delta scheme (www.sphinxconsultant.com/sphinx-search-delta-indexing/). When using deltas, it is often necessary to query on multiple indexes simultaneously. In order to achieve this using SphinxSearch, modify your config file to include the "name" and "mapping" keys like so:
You can also pass in multiple indexes (separated by comma or space) to your search like so (if the "mapping" key is not specified in the config, search retrieves ids):
Retrieve search result excerpts using Sphinx
It is nifty to display excerpts with keywords highlighted in search result. Sphinx supports this feature natively. http://sphinxsearch.com/docs/archives/2.0.3/api-func-buildexcerpts.html