You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Bill Bell (JIRA)" <ji...@apache.org> on 2010/12/07 19:23:11 UTC

[jira] Updated: (SOLR-2242) Get distinct count of names for a facet field

     [ https://issues.apache.org/jira/browse/SOLR-2242?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bill Bell updated SOLR-2242:
----------------------------

    Description: 
When returning facet.field=<name of field> you will get a list of matches for distinct values. This is normal behavior. This patch tells you how many distinct values you have (# of rows). Use with limit=-1 and mincount=1.



The feature is called "namedistinct". Here is an example:

http://localhost:8983/solr/select?q=*:*&facet=true&facet.field=manu&facet.mincount=1&facet.limit=-1&f.manu.facet.namedistinct=0&facet.field=price&f.price.facet.namedistinct=1

Here is an example on field "hgid" (without namedistinct):

- <lst name="facet_fields">
- <lst name="hgid">
  <int name="HGPY0000045FD36D4000A">1</int> 
  <int name="HGPY00000FBC6690453A9">1</int> 
  <int name="HGPY00001E44ED6C4FB3B">1</int> 
  <int name="HGPY00001FA631034A1B8">1</int> 
  <int name="HGPY00003317ABAC43B48">1</int> 
  <int name="HGPY00003A17B2294CB5A">5</int> 
  <int name="HGPY00003ADD2B3D48C39">1</int> 
  </lst>
  </lst>

With namedistinct (HGPY0000045FD36D4000A, HGPY00000FBC6690453A9, HGPY00001E44ED6C4FB3B, HGPY00001FA631034A1B8, HGPY00003317ABAC43B48, HGPY00003A17B2294CB5A, HGPY00003ADD2B3D48C39). This returns number of rows (7), not the number of values (11).

- <lst name="facet_fields">
- <lst name="hgid">
  <int name="_count_">7</int> 
  </lst>
  </lst>

This works actually really good to get total number of fields for a group.field=hgid. Enjoy!

  was:
See SOLR-236.

Need ability to get "count" back for the unique facets for grouping (field collapsing) instead of returning the facets. 




> Get distinct count of names for a facet field
> ---------------------------------------------
>
>                 Key: SOLR-2242
>                 URL: https://issues.apache.org/jira/browse/SOLR-2242
>             Project: Solr
>          Issue Type: New Feature
>          Components: Response Writers
>    Affects Versions: 4.0
>            Reporter: Bill Bell
>            Priority: Minor
>             Fix For: 4.0
>
>
> When returning facet.field=<name of field> you will get a list of matches for distinct values. This is normal behavior. This patch tells you how many distinct values you have (# of rows). Use with limit=-1 and mincount=1.
> The feature is called "namedistinct". Here is an example:
> http://localhost:8983/solr/select?q=*:*&facet=true&facet.field=manu&facet.mincount=1&facet.limit=-1&f.manu.facet.namedistinct=0&facet.field=price&f.price.facet.namedistinct=1
> Here is an example on field "hgid" (without namedistinct):
> - <lst name="facet_fields">
> - <lst name="hgid">
>   <int name="HGPY0000045FD36D4000A">1</int> 
>   <int name="HGPY00000FBC6690453A9">1</int> 
>   <int name="HGPY00001E44ED6C4FB3B">1</int> 
>   <int name="HGPY00001FA631034A1B8">1</int> 
>   <int name="HGPY00003317ABAC43B48">1</int> 
>   <int name="HGPY00003A17B2294CB5A">5</int> 
>   <int name="HGPY00003ADD2B3D48C39">1</int> 
>   </lst>
>   </lst>
> With namedistinct (HGPY0000045FD36D4000A, HGPY00000FBC6690453A9, HGPY00001E44ED6C4FB3B, HGPY00001FA631034A1B8, HGPY00003317ABAC43B48, HGPY00003A17B2294CB5A, HGPY00003ADD2B3D48C39). This returns number of rows (7), not the number of values (11).
> - <lst name="facet_fields">
> - <lst name="hgid">
>   <int name="_count_">7</int> 
>   </lst>
>   </lst>
> This works actually really good to get total number of fields for a group.field=hgid. Enjoy!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org