Download the PHP package divineomega/omega-search without Composer
On this page you can find all versions of the php package divineomega/omega-search. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download divineomega/omega-search
More information about divineomega/omega-search
Files in divineomega/omega-search
Package omega-search
Short Description Search allows you to easily add an intelligent search engine to your website or web application.
License LGPL-3.0-only
Informations about the package omega-search
Omega Search
Omega Search allows you to easily add an intelligent search engine to your website or web application. It can be configured to search any database table.
If you are using the Laravel framework, take a look at the Laravel Omega Search package.
Installation
You can install this package with Composer.
Usage
Using Omega Search is easy. Take a look at the following example.
The results are returned as a SearchResults
object, as shown below, containing an array of SearchResult
objects.
This SearchResults
object also contains various statistics such as the highest, lowest and average relevances,
and the time taken to perform the search.
Each SearchResult
object in the array provides the primary key id
and its relevance
. The relevance
is
simply a number that is higher on more relevant results. The array is sorted by relevance descending.
Overriding SQL
If you wish to write your own SQL query instead of using the one generated, for example if you wish to join another table, you can use the setSqlOverride
method. The query passed into this method must contain a SELECT
and LIMIT ? , ?
, an exception will be thrown otherwise. You can omit the setFieldsToSearch
method when overriding the SQL.
Take a look at the following example:
Caching Source Data
To speed up searching, you can cache the source data using any PSR-6 compliant cache pool. An example of this is shown below.
All versions of omega-search with dependencies
illuminate/support Version >=5.1
psr/cache Version ^1.0
ext-pdo Version *