On Sat, Sep 12, 2009 at 1:20 AM, smock <harish.agar...@gmail.com> wrote:

>
> I'd like to propose a change to the facet response structure.  Currently,
> it
> looks like:
>
> {'facet_fields':{'field1':[('value1',count1),('value2',count2),(null,missingCount)]}}
>
> My immediate problem with this structure is that null is not of the same
> type as the 'value's.  Also, the meaning of the (null,missingCount) tuple
> is
> not the same as the meaning of the ('value',count) tuples, it is a special
> case to represent the documents for which the field has no value.  I'd like
> to propose changing the response to:
>
> {'facet_fields',:{'field1':{'facets':[('value1',count1),('value2',count2)],'missing':missingCount}}}
>
>
Well, there are two problems:
1. 'missing' can be a value in the field
2. Facet support has been there for a long time. This would break
compatibility with existing clients.


>
> In addition to cleaning up the 'null' issue mentioned above, I think this
> will allow for greater flexibility moving forward with the facet component.
> For instance, it would be great if the FacetComponent could add an optional
> count of the 'hits', or number of distinct facet values contained in the
> query result.  If the facet request has a limit on it, this number is not
> available via a count of the returned facet values.  The response structure
> I've outlined above could accomodate this piece of metadata very easily:
>
> {'facet_fields',:{'field1':{'facets':[('value1',count1),('value2',count2)],'missing':missingCount,'hits':hitsCount}}}
>
>
Have you looked at StatsComponent? It give counts for total distinct values
and count of documents missing a value among other things:

http://wiki.apache.org/solr/StatsComponent

-- 
Regards,
Shalin Shekhar Mangar.

Reply via email to