开发者

Solr multiple facet dates

开发者 https://www.devze.com 2023-01-04 02:56 出处:网络
According to the Apache Solr documentation on facets, I can use keys because: \'This can be helpful when faceting on the same field multiple times with different exclusions.\'

According to the Apache Solr documentation on facets, I can use keys because: 'This can be helpful when faceting on the same field multiple times with different exclusions.'

I need them because I want to have a facet that gives me 'Last day', 'Last week', 'Last month' options.

However, when I specify a query with the following options set:

http://URL/select?
...unrelated...
facet=true开发者_JS百科&
facet.date={!key=some_key}created&
f.some_key.facet.date.start=NOW/DAY-1DAY&
f.some_key.facet.date.end=NOW/DAY&
f.some_key.facet.date.gap=NOW/DAY+1DAY
...unrelated...

Solr complains about:

[exception] => org.apache.solr.common.SolrException: Missing required parameter: f.created.facet.date.start (or default: facet.date.start)

When I set facet.date.start, or f.created.facet.date.start, they will override the fields of my some_key (start/end/gap) and this is useless because I need multiple keys... Can anyone point me in the right direction here? Due to limitations of the library I am using, this needs to be done in a single query.


You could use facet queries:

http://URL/select?
...unrelated...
facet=true&    
facet.query=[NOW-1DAY TO NOW]&
facet.query=[NOW-7DAY TO NOW]&
facet.query=[NOW-1MONTH TO NOW]&
...unrelated...
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号