Search code examples
grailssolrgrails-2.0grails-controller

How to read facet facet_ranges in grails?


A.<lst name="Age">
<int name="0">2</int>
<int name="2">1</int>
<int name="6">1</int>
<int name="9">1</int>
</lst>
</lst>

B.<lst name="facet_ranges">
<lst name="Age">
<lst name="counts">
<int name="0">3</int>
<int name="6">1</int>
<int name="9">1</int>
</lst>
<long name="gap">3</long>
<long name="start">0</long>
<long name="end">51</long>
</lst>
</lst>

i fired one RANGE query to solr database... it gives an Answer..A and B

But I am not able to read B part of answer. which is wanted to display on page i am using grails

Help me out

thank You!!


Solution

  • Check QueryResponse getFacetRanges which should return you the range facet responses.

    getFacetRanges().get(0) should return you RangeFacet

    RangeFacet getCounts() return you RangeFacet.Count which can be used to get the range and the value.