lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karthik Ramachandran <kramachand...@commvault.com>
Subject JSON Facet "allBuckets" behavior
Date Fri, 30 Sep 2016 14:43:47 GMT
While performing json faceting with "allBuckets" and "mincount", I not sure if I am expecting
a wrong result or there is bug?

By "allBucket" definition the response, representing the union of all of the buckets.

Schema:
<field name="id" type="string" indexed="true" required="true" docValues="true" />
<field name="filename" type="string" indexed="true" docValues="true" />
<field name="size" type="long" indexed="true" docValues="true" />

Dataset:
  <doc><field name="id">1</field><field name="filename">filename1</field><field
name="size">1</field></doc>
  <doc><field name="id">2</field><field name="filename">filename2</field><field
name="size">1</field></doc>
  <doc><field name="id">3</field><field name="filename">filename3</field><field
name="size">1</field></doc>
  <doc><field name="id">4</field><field name="filename">filename4</field><field
name="size">1</field></doc>
  <doc><field name="id">5</field><field name="filename">filename5</field><field
name="size">1</field></doc>
  <doc><field name="id">6</field><field name="filename">filename1</field><field
name="size">1</field></doc>
  <doc><field name="id">7</field><field name="filename">filename2</field><field
name="size">1</field></doc>
  <doc><field name="id">8</field><field name="filename">filename3</field><field
name="size">1</field></doc>
  <doc><field name="id">9</field><field name="filename">filename4</field><field
name="size">1</field></doc>
  <doc><field name="id">10</field><field name="filename">filename1</field><field
name="size">1</field></doc>
  <doc><field name="id">11</field><field name="filename">filename2</field><field
name="size">1</field></doc>
  <doc><field name="id">12</field><field name="filename">filename3</field><field
name="size">1</field></doc>
  <doc><field name="id">13</field><field name="filename">filename1</field><field
name="size">1</field></doc>
  <doc><field name="id">14</field><field name="filename">filename2</field><field
name="size">1</field></doc>
  <doc><field name="id">15</field><field name="filename">filename1</field><field
name="size">1</field></doc>

For my dataset, with request
http://localhost:8983/solr/jasonfacettest/select/?q=*:*&rows=0&json.facet= {"sumOfDuplicates":{"type":"terms","field":"filename","mincount":2,"numBuckets":true,"allBuckets":true,"sort":"sum
desc","facet":{"sum":"sum(size)"}}}

below is the response,
"response":{"numFound":15,"start":0,"docs":[]},"facets":{"count":15,"sumOfDuplicates":{"numBuckets":4,"allBuckets":{"count":15,"sum":15.0},"buckets":[{"val":"filename1","count":5,"sum":5.0},{"val":"filename2","count":4,"sum":4.0},{"val":"filename3","count":3,"sum":3.0},{"val":"filename4","count":2,"sum":2.0}]}}}

I was wonder, why the result is not this, since I have "mincount:2"
"response":{"numFound":15,"start":0,"docs":[]},"facets":{"count":15,"sumOfDuplicates":{"numBuckets":4,"allBuckets":{"count":14,"sum":14.0},"buckets":[{"val":"filename1","count":5,"sum":5.0},{"val":"filename2","count":4,"sum":4.0},{"val":"filename3","count":3,"sum":3.0},{"val":"filename4","count":2,"sum":2.0}]}}}

Thanks for the help!!

With Thanks & Regards
Karthik Ramachandran
P Please don't print this e-mail unless you really need to


Mime
View raw message