问题描述
我想知道SQL函数(DateAdd/DateDiff)在Azure搜索中是否可用.我找不到有关它的示例/文档,但是它们存在于ODATA官方文档中:
I would like to know if the SQL Functions (DateAdd / DateDiff) are available on Azure Search. I could not find examples / docs about it, but they exist on ODATA official doc:
http://cdn.cdata.com/help/RDA/jdbc/pg_sqldatefunctions.htm
如果它们不可用,建议使用哪种日期差异作为过滤器(例如,年龄gt 18).
In case they are not available, what is the recommended way for date diffs as filters (e.g Age gt 18).
推荐答案
Azure Search当前不支持OData日期函数.您可以通过以下两种方式之一对这个特定问题进行建模:将特定单位的时间跨度存储为整数(例如,以年为单位的年龄),或者将所有内容建模为DateTimeOffset,然后在它们之间进行比较.例如: DateOfBirth lt 2000-07-03T00:00Z
Azure Search does not currently support OData date functions. You can model this particular problem in one of two ways: Either store time spans of a particular unit as integers (for example, age in years), or model everything as DateTimeOffset and just compare between them. For example: DateOfBirth lt 2000-07-03T00:00Z
这篇关于天蓝色搜索-datediff/dateadd函数可用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!