Boosting docs based on date range

旧时模样 提交于 2019-12-24 21:47:20

问题


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"
}

I get an error: { "error": {"code": "", "message": "Illegal arguments in query request: publishedDate is not a searchable field." } }


回答1:


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.

Nate



来源:https://stackoverflow.com/questions/49680139/boosting-docs-based-on-date-range

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!