lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Bell (Commented) (JIRA)" <>
Subject [jira] [Commented] (SOLR-2242) Get distinct count of names for a facet field
Date Tue, 20 Mar 2012 05:35:52 GMT


Bill Bell commented on SOLR-2242:

How does it work?



facet.numTerms or f.<field>.facet.numTerms = true (default is false) - turn on distinct
counting of terms
facet.field - the field to count the terms

It creates a new section in the facet section... For example:

<lst name="facet_counts">
  <lst name="facet_queries"/>
  <lst name="facet_fields">
    <lst name="cat">
      <int name="camera">1</int>
      <int name="connector">2</int>
      <int name="copier">1</int>
      <int name="currency">4</int>
      <int name="electronics">14</int>
      <int name="graphics card">2</int>
      <int name="hard drive">2</int>
      <int name="memory">3</int>
      <int name="monitor">2</int>
      <int name="multifunction printer">1</int>
      <int name="music">1</int>
      <int name="printer">1</int>
      <int name="scanner">1</int>
      <int name="search">2</int>
      <int name="software">2</int>
    <lst name="price">
      <int name="0.0">3</int>
  <lst name="facet_numTerms">
    <int name="cat">15</int>
    <int name="price">14</int>
  <lst name="facet_dates"/>
  <lst name="facet_ranges"/>

> Get distinct count of names for a facet field
> ---------------------------------------------
>                 Key: SOLR-2242
>                 URL:
>             Project: Solr
>          Issue Type: New Feature
>          Components: Response Writers
>    Affects Versions: 4.0
>            Reporter: Bill Bell
>            Assignee: Erick Erickson
>            Priority: Minor
>             Fix For: 4.0
>         Attachments:, SOLR-2242-notworkingtest.patch, SOLR-2242-solr40.patch,
SOLR-2242.patch, SOLR-2242.patch, SOLR-2242.patch, SOLR-2242.shard.patch, SOLR-2242.shard.patch,
SOLR-2242.shard.withtests.patch, SOLR-2242.solr3.1-fix.patch, SOLR-2242.solr3.1.patch, SOLR.2242.solr3.1.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?shards=localhost:8983/solr,localhost:7574/solr&indent=true&q=*:*&facet=true&facet.mincount=1&facet.numFacetTerms=2&facet.limit=-1&facet.field=price
> http://localhost:8983/solr/select?shards=localhost:8983/solr,localhost:7574/solr&indent=true&q=*:*&facet=true&facet.mincount=1&facet.numFacetTerms=0&facet.limit=-1&facet.field=price
> http://localhost:8983/solr/select?shards=localhost:8983/solr,localhost:7574/solr&indent=true&q=*:*&facet=true&facet.mincount=1&facet.numFacetTerms=1&facet.limit=-1&facet.field=price
> This currently only works on facet.field.
> {code}
> <lst name="facet_fields">
>   <lst name="price">
>     <int name="numFacetTerms">14</int>
>     <int name="0.0">3</int><int name="11.5">1</int><int name="19.95">1</int><int
name="74.99">1</int><int name="92.0">1</int><int name="179.99">1</int><int
name="185.0">1</int><int name="279.95">1</int><int name="329.95">1</int><int
name="350.0">1</int><int name="399.0">1</int><int name="479.95">1</int><int
name="649.99">1</int><int name="2199.0">1</int>
>   </lst>
> </lst>
> {code} 
> Several people use this to get the group.field count (the # of groups).

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message