[
https://issues.apache.org/jira/browse/SOLR-2242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13048964#comment-13048964
]
Bill Bell commented on SOLR-2242:
---------------------------------
Lance,
There is literally 15 lines of code changes. Not sure how you cannot follow it.
I could use no memory and just loop through the results, but that would not be
cached - so the speed would still be slow since I need to pull in the array in
order to count it.
The field is not called namedistinct anymore... It is called
facet.numFacetTerms=2,1,0.
All other parameters are good. Also you do not need anything else to get it to
work, since I set the defaults to work for you now.
I'll see if I can write some more tests. Here is the rub: I would be happy to
wrote hundreds of test cases if I knew someone was going to actually help me
get this done. I am used to having a committer actually work with me - Mike
McCandless is awesome and we worked on several issues together. But I have seen
tons of features die when no one is willing to help. So here I am wanting,
willing and able to get this done. And I have no one willing to assist from a
committer perspective... The patch works fine in sharded and normal mode. So
people can use it today. It is just not committed.
I have 4 clients using it in production and one has 100M page views a year, and
so far no problems.
http://localhost:8983/solr/select?shards=localhost:8983/solr,localhost:7574/solr&indent=true&q=*:*&facet=true&facet.mincount=1&facet.numFacetTerms=2&facet.limit=-1&facet.field=price
> 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
>
> Attachments: SOLR-2242.patch, SOLR-2242.shard.patch,
> SOLR-2242.solr3.1.patch, SOLR.2242.solr3.1.patch, SOLR.2242.v2.patch
>
>
> 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):
> {code}
> - <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>
> {code}
> With namedistinct (HGPY0000045FD36D4000A, HGPY00000FBC6690453A9,
> HGPY00001E44ED6C4FB3B, HGPY00001FA631034A1B8, HGPY00003317ABAC43B48,
> HGPY00003A17B2294CB5A, HGPY00003ADD2B3D48C39). This returns number of rows
> (7), not the number of values (11).
> {code}
> - <lst name="facet_fields">
> - <lst name="hgid">
> <int name="_count_">7</int>
> </lst>
> </lst>
> {code}
> This works actually really good to get total number of fields for a
> group.field=hgid. Enjoy!
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]