Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-3973

Cross facet, faceting on multiple columns.

    XMLWordPrintableJSON

Details

    Description

      We often come across the scene of the multi-faceted cross, For example, the SQL statement, select count( * ) from table group by A,B.

      Now we slightly modified for FacetComponent, this component to be able to support the multi-faceted cross.you can facet on multiple columns, and get the count result of multi-faceted cross.

      Request parameters are as follows:
      &start=0&rows=0&q=:&facet=true&facet.field=user_city&facet.field=user_province&facet.limit=10&facet.cross=true&facet.cross.sep=,

      The original effect is as follows:
      <result name="response" numFound="479140" start="0" sum="0.0" max="-Infinity" min="Infinity"/>
      <lst name="facet_counts">
      <lst name="facet_queries"/>
      <lst name="facet_fields">
      <lst name="user_city">
      <int name="Beijing">16852</int>
      <int name="ShangHai">16787</int>
      <int name="Gunagzhou">12950</int>
      <int name="Shenzhen">11667</int>
      <int name="Hangzhou">9997</int>
      <int name="Chongqing">7624</int>
      <int name="Chengdu">7082</int>
      <int name="Wuhan">6894</int>
      <int name="Suzhou">6528</int>
      <int name="Tianjin">5822</int>
      </lst>
      <lst name="user_province">
      <int name="Gunagdong">48621</int>
      <int name="Zhengjiang">34634</int>
      <int name="Jiangsu">28748</int>
      <int name="Shandong">20389</int>
      <int name="Fujian">18508</int>
      <int name="Beijing">16852</int>
      <int name="Shanghai">16787</int>
      <int name="Hubei">15227</int>
      <int name="Sichuan">15112</int>
      <int name="Hebei">13793</int>
      </lst>
      </lst>
      <lst name="facet_numTerms"/>
      <lst name="facet_dates"/>
      <lst name="facet_ranges"/>
      </lst>

      The effect of the new features are as follows:

      <result name="response" numFound="479140" start="0" sum="0.0" max="-Infinity" min="Infinity"/>
      <lst name="facet_counts">
      <lst name="facet_queries"/>
      <lst name="facet_fields">
      <lst name="user_city,user_province">
      <int name="Beijing,Beijing">16852</int>
      <int name="Shanghai,Shanghai">16787</int>
      <int name="Guangzhou,Gunagdong">12950</int>
      <int name="Shenzheng,Guangdong">11667</int>
      <int name="Hangzhou,Zhejiang">9997</int>
      <int name="Chongqing,Chongqing">7624</int>
      <int name="Chengdu,Sichuan">7082</int>
      <int name="Wuhan,Hubei">6894</int>
      <int name="Suzhou,Jiangsu">6528</int>
      </lst>
      </lst>
      <lst name="facet_numTerms"/>
      <lst name="facet_dates"/>
      <lst name="facet_ranges"/>
      </lst>
      </response>

      Attachments

        1. crossfacet.patch
          10 kB
          ZhengBowen

        Activity

          People

            Unassigned Unassigned
            bowen.zheng ZhengBowen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: