【发布时间】:2014-08-11 23:39:31
【问题描述】:
我正在尝试使用 FOSElastica Bundle 的全局索引搜索返回亮点。
我的配置(yml 文件)中有一个全局索引查找器:
fos_elastica:
clients:
default: { host: %elastic_host%, port: %elastic_port% }
indexes:
myIndex:
client: default
finder: ~
types:
# different types here
我按照文档 (here) 使用它:
$finder = $this->container->get('fos_elastica.finder.myIndex');
// Returns a mixed array of any objects mapped
$results = $finder->find('whatever');
完美运行并返回预期结果。 现在我想突出显示结果中的单词,例如使用 ES 的 fast vector highlighter。但是我没有找到任何示例或任何文档。
我想我需要定义一个更合适的 \Query 对象,例如:
$query = new \Elastica\Query();
$query->setHighlights(array("whatever"));
$query->setTerm("whatever");
$results = $finder->find($query);
但是我找不到任何信息。有什么提示吗?
非常感谢!!
【问题讨论】:
标签: php search elasticsearch highlighting foselasticabundle