Searchy is an easy-to-use Laravel Optimized package that makes running user driven searches on data in your models simple and effective.
Searchy is an; easy-to-use, light-weight, MySQL only, Laravel package that makes running user driven searches on data in your models simple and effective.
It uses pseudo fuzzy searching and other weighted mechanics depending on the search driver that you have enabled.
It requires no other software installed on your server (so can be a little slower than dedicated search programs) but can be set up and ready to go in minutes.
Installation
----------------------------------------
Add `"tom-lingham/searchy" : "2.0~"` to your composer.json file under `require`:
Add `"tom-lingham/searchy" : "2.0"` to your composer.json file under `require`:
```
"require": {
"laravel/framework": "5.*",
"tom-lingham/searchy" : "dev-master"
"tom-lingham/searchy" : "2.0"
}
```
Run `composer update` in your terminal to pull down the package into your vendors folder.
Add the service provider to the `providers` array in Laravel's app/config/app.php file:
```php
'TomLingham\Searchy\SearchyServiceProvider'
TomLingham\Searchy\SearchyServiceProvider::class
```
Add the Alias to the `aliases` array in Laravel's app/config/app.php file if you want to have quick access to it in your application:
Sometimes you may want to leverage searches on concatenated column. For example, on a `first_name` and `last_name` field but you only want to run the one query. To do this can separate columns with a double colon:
The Fuzzy Search Driver is simply another group of matchers setup as follows. The multipliers are what I have used, but feel free to change these or roll your own driver with the same matchers and change the multipliers to suit.
The Levenshtein Search Driver uses the Levenshetein Distance to calculate the 'distance' between strings. It requires that you have a stored procedure in MySQL similar to the following `levenshtein( string1, string2 )`. There is an SQL file with a suitable function in the `res` folder - feel free to use this one.
Matches an exact string and applies a high multiplier to bring any exact matches to the top.
When sanitize is on, if the expression strips some of the characters from the search query then this may not be able to match against a string despite entering in an exact match.
#### StartOfStringMatcher
@ -187,13 +192,3 @@ Contributing & Reporting Bugs
----------------------------------------
If you would like to improve on the code that is here, feel free to submit a pull request.
If you find any bugs, submit them here and I will respond as soon as possible. Please make sure to include as much information as possible.
Road Map
----------------------------------------
To the future! The intention is to (eventually):
1. Remove Searchy's dependancy on Laravel
2. Include more drivers for more advanced searching (Including file system searching, indexing and more)
3. Implement an AJAX friendly interface for searching models and implementing auto-suggestion features on the front end
4. Speed up search performance and improve result relevance