Multiple ranges in a facet in solr

旧巷老猫 提交于 2019-12-01 14:11:51

You can also use it as shown below.

fq=pageviews:([200 TO 250] OR [500 TO 550])

Turns out I need to mention the field each time:

pageviews:[200 TO 250] OR pageviews:[500 TO 550]

I believe that the complete answer to this question should include a way to configure all the parameters of these "repeated" facets. This is how it would be done in Solr 4.4.0, using JSON.

"facet.range": [

    "{!key=twohundred " +
        "f.pageviews.facet.range.start=200 " +
        "f.pageviews.facet.range.end=250 " + 
        "f.pageviews.facet.range.gap=1 " +
    "}pageviews",

    "{!key=fivehundred " +
        "f.pageviews.facet.range.start=500 " +
        "f.pageviews.facet.range.end=550 " + 
        "f.pageviews.facet.range.gap=10 " +
    "}pageviews"

]

(Notice that each entry in the array is supposed to be a string without linebreaks, but are divided here for clarity.)

This way each facet can be individually labeled, modified (I changed the gap for 'fivehundred'), or any other parameters can be added (like 'facet.range.other').

Source: https://issues.apache.org/jira/browse/SOLR-1351

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