简体   繁体   English

如何在阿尔及利亚的搜索中获得最大值和最小值的数值

[英]How can I get max and min numeric value with in the search in algolia

我试图将我的日期范围过滤器限制在结果的最大和最小日期值中(整个结果不只是首页),algolia是否有办法返回返回值中该值的最小和最大值注意:其数字属性不是构面

If one of the facets you defined contains numerical values, the API response will contain a facets_stats key. 如果您定义的方面之一包含数值,则API响应将包含facets_stats键。 It's an object with one key per facet, and each of those keys contains the following informations: min , max , avg and sum . 它是一个对象,每个面都有一个键,并且每个键都包含以下信息: minmaxavgsum

在此处输入图片说明

You can find more informations about the API response format in the doc . 您可以在doc中找到有关API响应格式的更多信息。

The JS Helper actually has a getFacetStats method to get that data. JS Helper实际上有一个getFacetStats方法来获取该数据。

Note that those values are dynamic, and relative to the others filters currently applied (ie. they are the min and max values of the items that currently match your query ). 请注意,这些值是动态的,并且相对于当前应用的其他过滤器而言(即,它们是当前与您的查询匹配的项目的最小值和最大值)。 If you want the absolute min and max of all the items in your index, you will have to do first an empty query (no filters, no keyword) and save those min/max somewhere. 如果要获取索引中所有项目的绝对最小值和最大值,则必须首先执行一个空查询(没有过滤器,没有关键字),然后将这些最小值/最大值保存在某个地方。

You have to add you attribute to the attributesForFacetting for this to work. 您必须将属性添加到attributesForFacetting才能起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 通过Algolia在我们的网站上搜索时,它会显示最高 5结果。 如何更改限额? - When searching on our website through Algolia it shows max. 5 results. How can I change the limit? 如何使用Algolia Search for Wordpress根据多面属性的值过滤出某些结果? - How do I filter out certain results based on the value of a faceted Attribute with Algolia Search for Wordpress? 如何在Algolia Search中获得“ maxValuesPerFacet”以与多索引查询一起使用? - How do I get “maxValuesPerFacet” in Algolia Search to work with a multiple index query? 如何在MySQL的两个字段上使用max和min搜索? - how to search with max and min on two fields mysql? 如何在阿尔戈利亚按时长搜索 - How to search by duration in Algolia 从Codeigniter中的$ _GET数据在数据库的最小值和最大值之间进行搜索 - Search between min and max in database from $_GET data in codeigniter 弹性(搜索):获取具有最大和最小时间戳值的文档 - Elastic(search): Get docs with max and min timestamp values 如何在即时搜索窗口小部件上设置Algolia searchableAttributes? - How can I set Algolia searchableAttributes on an instantsearch widget? 无法从我的 react-native 应用程序中进行 Algolia 搜索 - Can't get Algolia search to work from my react-native app 如何获取Algolia对象快照 - how to get Algolia object snapshot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM