Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change 
notification.

The following page has been changed by HossMan:
http://wiki.apache.org/solr/SimpleFacetParameters

------------------------------------------------------------------------------
  
  = Examples =
  
- /!\ :TODO: /!\ fill in the blanks
+ '''Note:''' In many of these examples "rows" is set to 0 so that the main 
result set is empty, to better emphasize the facet data.
  
+ == Facet Fields ==
+ 
+ 
`http://localhost:8983/solr/select?q=ipod&rows=0&facet=true&facet.field=cat&facet.field=inStock`
+ 
+ {{{
+ <response>
+ <responseHeader><status>0</status><QTime>2</QTime></responseHeader>
+ <result numFound="4" start="0"/>
+ <lst name="facet_counts">
+  <lst name="facet_queries"/>
+  <lst name="facet_fields">
+   <lst name="cat">
+       <int name="search">0</int>
+       <int name="memory">0</int>
+       <int name="graphics">0</int>
+       <int name="card">0</int>
+       <int name="music">1</int>
+       <int name="software">0</int>
+       <int name="electronics">3</int>
+       <int name="copier">0</int>
+       <int name="multifunction">0</int>
+       <int name="camera">0</int>
+       <int name="connector">2</int>
+       <int name="hard">0</int>
+       <int name="scanner">0</int>
+       <int name="monitor">0</int>
+       <int name="drive">0</int>
+       <int name="printer">0</int>
+   </lst>
+   <lst name="inStock">
+       <int name="false">3</int>
+       <int name="true">1</int>
+   </lst>
+  </lst>
+ </lst>
+ </response>
+ }}}
+ 
+ == Facet Fields with No Zeros ==
+ 
+ 
`http://localhost:8983/solr/select?q=ipod&rows=0&facet=true&facet.field=cat&facet.zeros=false&facet.field=inStock`
+ 
+ {{{
+ <response>
+ <responseHeader><status>0</status><QTime>3</QTime></responseHeader>
+ <result numFound="4" start="0"/>
+ <lst name="facet_counts">
+  <lst name="facet_queries"/>
+  <lst name="facet_fields">
+   <lst name="cat">
+       <int name="music">1</int>
+       <int name="connector">2</int>
+       <int name="electronics">3</int>
+   </lst>
+   <lst name="inStock">
+       <int name="false">3</int>
+       <int name="true">1</int>
+   </lst>
+  </lst>
+ </lst>
+ </response>
+ }}}
+ 
+ 
+ == Facet Fields with No Zeros And Missing Count For One Field ==
+ 
+ 
`http://localhost:8983/solr/select?q=ipod&rows=0&facet=true&facet.field=cat&f.cat.facet.missing=true&facet.zeros=false&facet.field=inStock`
+ 
+ {{{
+ <response>
+ <responseHeader><status>0</status><QTime>3</QTime></responseHeader>
+ <result numFound="4" start="0"/>
+ <lst name="facet_counts">
+  <lst name="facet_queries"/>
+  <lst name="facet_fields">
+   <lst name="cat">
+       <int name="music">1</int>
+       <int name="connector">2</int>
+       <int name="electronics">3</int>
+         <int>1</int>
+   </lst>
+   <lst name="inStock">
+       <int name="false">3</int>
+       <int name="true">1</int>
+   </lst>
+  </lst>
+ </lst>
+ </response>
+ }}}
+ 
+ 
+ == Facet Field with Limit ==
+ 
+ 
`http://localhost:8983/solr/select?rows=0&q=inStock:true&facet=true&facet.field=cat&facet.limit=5`
+ 
+ {{{
+ <response>
+ <responseHeader><status>0</status><QTime>4</QTime></responseHeader>
+ <result numFound="12" start="0"/>
+ <lst name="facet_counts">
+  <lst name="facet_queries"/>
+  <lst name="facet_fields">
+   <lst name="cat">
+       <int name="electronics">10</int>
+       <int name="memory">3</int>
+       <int name="drive">2</int>
+       <int name="hard">2</int>
+       <int name="monitor">2</int>
+   </lst>
+  </lst>
+ </lst>
+ </response>
+ }}}
+ 
+ == Facet Fields and Facet Queries ==
+ 
+ 
`http://localhost:8983/solr/select?q=video&rows=0&facet=true&facet.field=inStock&facet.query=price:[*+TO+500]&facet.query=price:[500+TO+*]`
+ 
+ {{{
+ <response>
+ <responseHeader><status>0</status><QTime>11</QTime></responseHeader>
+ <result numFound="3" start="0"/>
+ <lst name="facet_counts">
+  <lst name="facet_queries">
+   <int name="price:[* TO 500]">2</int>
+   <int name="price:[500 TO *]">1</int>
+  </lst>
+  <lst name="facet_fields">
+   <lst name="inStock">
+       <int name="false">2</int>
+       <int name="true">1</int>
+   </lst>
+  </lst>
+ </lst>
+ </response>
+ }}}
+ 

Reply via email to