This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Algolia\ScoutExtended\Facades\Algolia; | |
$client = Algolia::client(); | |
$apiKeys = $client->listApiKeys(); | |
$indices = $client->listIndices(); | |
$client->copyIndex('indexNameSrc', 'indexNameDest'); | |
$client->moveIndex('indexNameSrc', 'indexNameDest'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return [ | |
/* | |
|-------------------------------------------------------------------------- | |
| Searchable Attributes | |
|-------------------------------------------------------------------------- | |
| | |
| Limits the scope of a search to the attributes listed in this setting. Defining |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$articles = Article::search('Star Trek') | |
->with([ | |
'hitsPerPage' => 30, | |
'filters' => 'attribute:value', | |
'typoTolerance' => false, | |
])->get(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$articles = Article::search('query') | |
->aroundLatLng(48.8588536, 2.3125377) | |
->get(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$products = Products::search('Star Trek') | |
->whereBetween('price', [100, 200]) | |
->get(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$articles = Article::search('Star Trek')->where('views', '>', 100)->get(); | |
$articles = Article::search('Star Trek')->where('created_at', '>=', now()->subDays(7))->get(); | |
$articles = Article::search('Star Trek')->where('views', 100)->get(); // views = 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$models = App\Search\News::search('Star Trek')->get(); | |
echo get_class($models[0]); // "App\Article" | |
echo get_class($models[1]); // "App\Comment" | |
$results = App\Search\News::search('Star Trek')->raw(); | |
/* | |
{ | |
"hits":[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
use App\Search\News; | |
use Illuminate\Support\ServiceProvider; | |
class AppServiceProvider extends ServiceProvider | |
{ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Search; | |
use Algolia\ScoutExtended\Searchable\Aggregator; | |
class News extends Aggregator | |
{ | |
/** | |
* The names of the models that should be aggregated. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"chmod": "0755", | |
"directories": [ | |
"app", | |
"bootstrap", | |
"config", | |
"vendor" | |
], | |
"files": [ | |
"composer.json" |