[英]Setting Algolia index attributes with Laravel Scout
I am enjoying working with Laravel Scout and Algolia and I am able to index my content. 我很喜欢与Laravel Scout和Algolia一起工作,并且能够索引我的内容。 (I am using the Algolia JS library to perform the searches).
(我正在使用Algolia JS库执行搜索)。
However I want to get my facets for the search results but this needs to be done on the server side and I don't see how to this with scout. 但是,我想获取搜索结果的信息,但这需要在服务器端完成,而且我不知道如何使用侦察器。 For example if I want to allow retrieval of the facets author and type I would like to set the following attribute on :
例如,如果我要允许检索构面作者和类型,则要在上设置以下属性:
$index->setSettings(array("attributesForFaceting" => array("authors", "type")));
I would be fine doing it in JS but somehow Algolia is highly suggesting to do this on the backend client - Laravel Scout for me: 我可以在JS中做到这一点,但是Algolia强烈建议在后端客户端-Laravel Scout上做到这一点:
"please consider using a backend client to change the index settings"
“请考虑使用后端客户端来更改索引设置”
Not being familiar with Laravel Scout, I was only giving generic advice in the comments section : 不熟悉Laravel Scout,我只在评论部分提供一般性建议:
After looking into Laravel Scout, there is a pending pull request from Algolia to expose the setSettings
method exactly to achieve what you're looking for. 在研究了Laravel Scout之后,Algolia发出了一个待处理的请求,以完全公开
setSettings
方法来实现您想要的目标。
In the meantime, you can probably extend the AlgoliaEngine
trait to add this method on your own, or just have a small script on the side to set those settings. 同时,您可以扩展
AlgoliaEngine
特性以自行添加此方法,或者仅在侧面有一个小的脚本来设置这些设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.