0

我的应用程序有两个类型(或更多)数据,如下所示:

  1. 名称:纽约时报新闻报道,start_dt:2013-09-13T
  2. 名称:纽约时报频道
  3. 名称:纽约时报新闻报道,start_dt:2013-09-10T

如果有字段 start_dt,我想订购结果,所以我的查询是:

q=nytimes+AND+start_dt:[NOW+TO+NOW/DAY%2B2DAY]

但我想得到上面第 1/2 号的结果,我该怎么办?

- - - 编辑 - - - -

我将 sortMissingFirst 与更复杂的查询一起使用:

<field name="start_dt" type="date" indexed="true" stored="false" sortMissingFirst='true'/>

q=(nytimes)+OR+(nytimes+AND+start_dt:[NOW+TO+NOW/DAY%2B2DAY])&sort=start_dt+asc

只是我想要的。

4

1 回答 1

0
  1. sort by start_date with the sortMissingLast option enabled on the field. This will cause all the results with blank start_date to be pushed at the end. You would lose the scoring however.

  2. Boost on the basis of existence of the field start_date:[* TO *]^10 (with edismax use bq) so that the results would be pushed up if the field has any value.

于 2013-09-12T07:45:14.363 回答