[英]How do I get “maxValuesPerFacet” in Algolia Search to work with a multiple index query?
I am trying to execute the query below on my indices, but the responses I get seem to not respect the maxValuesPerFacetParam. 我正在尝试对索引执行以下查询,但是我得到的响应似乎不尊重maxValuesPerFacetParam。 I would ideally expect 1 record from each of the facets to be retrieved using the below query.
理想情况下,我希望使用以下查询从每个构面中检索1条记录。 Is that now how it is expected to behave?
现在是那样吗?
curl -X POST \ ✱
-H "X-Algolia-API-Key: ${API_KEY}" \
-H "X-Algolia-Application-Id: ${APPLICATION_ID}" \
--data-binary "{ \"requests\": [
{ \"indexName\": \"index1\", \"params\": \"query=*&maxValuesPerFacet=1&hitsPerPage=5&facetFilters=(cat:life,cat:politics,cat:sports,cat:ideas,cat:design)\" },
{ \"indexName\": \"index2\", \"params\": \"query=*\" }
]}" \
"https://${APPLICATION_ID}-dsn.algolia.net/1/indexes/*/queries?strategy=none"
The maxValuesPerFacet
is not the number of hits retrieved per facet value; maxValuesPerFacet
不是每个构面值检索到的匹配数; but rather the number of facet values per facet. 而是每个构面的构面值数量。 Ex: you've a
category
attribute that you facet on, if you put maxValuesPerFacet=2
it means the retrieved facets will have 2 values max (like Electronics
and Food
). 例如:你已经一个
category
,你小面的,如果你把属性maxValuesPerFacet=2
这意味着检索方面将有2值MAX(像Electronics
和Food
)。
If you want to limit the number of results sharing a specific attribute value, you should take a look at the distinct feature, it seems to fit exactly what you're describing. 如果要限制共享特定属性值的结果的数量,则应查看独特的功能,该功能似乎完全符合您的描述。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.