Route::get('delete_project/{project_id}', function($project_id){
$project = \Illuminate\Support\Facades\Auth::user()->projects()->where('project_id', $project_id)->get()->first();
$index = Algolia::connection('main')->initIndex(\Illuminate\Support\Facades\Auth::user()->email);
$result = $index->search($project->name, array('facetFilters' => 'project.name') );
dd($result);
$project->delete();
})->middleware('auth');
dd返回我的所有algolia项目,我只想使用$ project-> id的project.id中的那个。
我有以下结构:
答案 0 :(得分:1)
尝试使用numericFilters:https://www.algolia.com/doc/ruby#numeric-search-parameters
$args = [
'facetFilters' => 'project.name',
'numericFilters' => 'id=' . $project->id
];
$result = $index->search($project->name, $args);
答案 1 :(得分:0)
应该是这样的:
$result = $index->search("", ['facetFilters' => ['project.name:'.$project->name]]);
“”作为查询将匹配所有内容 但facetFilters将仅过滤到具有良好项目名称的记录