对过去和未来的日期值应用提升因子

Apply boosting factor for date values in the past and in the future

我所有的文档都有日期字段,这些日期可以是过去的也可以是将来的。我需要的是提升与范围内的日期对应的文档(现在 - 2 周,现在 + 2 周)。 但是文档说:

In the current service release, one end of the range will be fixed to the current time. The other end is a time in the past based on the boostingDuration. To boost a range of times in the future, use a negative boostingDuration.

所以我无法通过一个评分配置文件提升过去和未来的文档。

一种解决方法是在您的文档中添加一个包含日期 2 周的字段,然后从那里应用积极的提升。它引入了一些冗余,但它会解除这种情况。

解决方案是创建一个包含计算列的视图: 案例
当 EntryDate < getdate() 那么 EntryDate else dateadd(minute, -datediff(minute, getdate(), EntryDate), getdate())
结束为 VenueEventStartDateDiffAbs

此表达式 return (now - x days) 和 (now + x days) 的相同输出。对此列应用 boostDuration 可以获得当前日期的最高分数。