PHP code example of xcalder / laravel-scout-xunsearch
1. Go to this page and download the library: Download xcalder/laravel-scout-xunsearch library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xcalder / laravel-scout-xunsearch example snippets
$users = App\Users::search('Star Trek')
->where('***', new \Scout\Xunsearch\Operators\FacetsOperator(array('age','city')))->get();
namespace App;
use Scout\Xunsearch\Searchable;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use Searchable;
/**
* 获取模型的索引名称.
* 加上前缀,为了多个项目索引共存
*
* @return string
*/
public function searchableAs()
{
return config('scout.prefix').'_article';
}
/**
* Get the indexable data array for the model.
*
* @return array
*/
public function toSearchableArray()
{
$array = $this->toArray();
// Customize array...
return $array;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.