我有一个搜索查询,我想在相关参数进入时进行一些过滤。
目前的问题是,虽然我尝试了各种选项,但我没有得到任何结果,例如 let imgManager = PHImageManager.default()
let requestOptions = PHImageManager()
requestOptions.synchronous = true //error:Value of type 'PHImageManager' has no member 'synchronous'
requestOptions.deliveryMode = .highQualityFormat // error:Value of type 'PHImageManager' has no member 'deliveryMode'
,match
和term
。
match
映射如下所示:
$records = $this->record->search()->querystring('*'.$searchTerm.'*', [
'fields' => [
'original_title^4',
'contributors.name',
'customTitles.custom_title',
],
])->aggregate(function (AggregationBuilder $builder) {
$builder->terms('group_by_type', 'type');
});
if (isset($filters['recordType'])) {
$records = $records->term('recordType.type', 'movie');
}
$records = $records->size(500)->get()->hits();
/**
* Maps the Eloquent model to ElasticSearch
* @return array
*/
public function buildDocument()
{
return [
'id' => $this->id,
'record_type_id' => $this->record_type_id,
'original_name' => $this->original_name,
'first_release_year' => $this->first_release_year,
'created_at' => $this->getElasticCreatedAt(),
'updated_at' => $this->getElasticUpdatedAt(),
'recordType' => $this->recordType,
];
}
中的recordType
关系定义如下:
Record
我非常感谢任何想法
更新 没有过滤器的响应如下所示:
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function recordType()
{
return $this->belongsTo(RecordType::class, 'record_type_id');
}