根据日期范围提升文档 [英] Boosting docs based on date range
问题描述
我将能够基于日期过滤文档,但是我真正需要的是提高某些日期范围.以下查询返回结果.
I am to be able to filter documents based on a date, but what I really need is to boost certain date ranges higher. The following query returns results.
{
"queryType":"full",
"search": "(priority:High^50 || Normal^10) AND (type:one^1 || two^10)",
"filter": "(type eq 'one' or type eq 'two') and publishedDate eq 2018-04-01",
"searchMode": "all"
}
但是我真的不想过滤那些,我想增加某些日期.我真正想要的是这样的东西:
But I don't really want to filter those, I want to boost certain dates. What I really want is something like this:
{
"queryType":"full",
"search": "(priority:High^50 || Normal^10) AND (type:one^1 || two^10) AND publishedDate:2018-04-01^100",
"filter": "(type eq 'one' or type eq 'two')",
"searchMode": "all"
}
我得到一个错误: { 错误": {代码": "", "message":查询请求中的参数非法:publishedDate不是可搜索的字段." } }
I get an error: { "error": {"code": "", "message": "Illegal arguments in query request: publishedDate is not a searchable field." } }
推荐答案
请查看Azure搜索中的评分配置文件. https://docs.microsoft.com/en-us/rest/api/searchservice/add-scoring-profiles-to-a-search-index .您可以在datetime字段上指定新鲜度函数,并提供一系列日期以增强匹配度.
Please take a look at scoring profiles in Azure Search. https://docs.microsoft.com/en-us/rest/api/searchservice/add-scoring-profiles-to-a-search-index. You can specify a freshness function on the datetime field and give a range of dates to boost matches.
内特
这篇关于根据日期范围提升文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!