我想使用“More Like This”查询来查找相似的文档并折叠那些在“image”字段中具有相同值的文档。我尝试使用Field Collapsing 参数,但它们似乎不适用于“更像这样”。
下面是我的代码片段。你能告诉我如何使用“More Like This”查询来折叠结果吗?
$url = "http://{$host}:{$port}/solr/{$core}/mlt";
$data = [
'stream.body' => $content,
'fl' => 'image,content,title,signature',
'start' => 0,
'order' => "score desc",
'wt' => 'json',
'mlt.fl' => 'content,title',
// these lines do nothing ---v
'group' => 'true',
'group.field' => 'image',
'group.sort' => 'impressions desc',
'group.main' => 'true'
];
$curlHandle = curl_init($url);
$options = array (
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $data
);
curl_setopt_array($curlHandle , $options);
$result = json_decode(curl_exec($curlHandle));