You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2014/07/25 07:55:28 UTC

[Solr Wiki] Update of "SimpleFacetParameters" by TomasFernandezLobbe

Dear Wiki user,

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

The "SimpleFacetParameters" page has been changed by TomasFernandezLobbe:
https://wiki.apache.org/solr/SimpleFacetParameters?action=diff&rev1=68&rev2=69

Comment:
Added Interval Faceting

  }}}
  === facet.pivot.mincount ===
  The minimum number of documents that need to match for the result to show up in the results.  Default value is 1
+ 
+ == Interval Faceting ==
+ <!> [[Solr4.10]] Another supported form of faceting is “Interval Faceting”. This sounds similar to “Range Faceting”, but the functionality is really closer to doing “Facet Queries” with range queries. Interval Faceting allows you to set variable intervals and count the number of documents that have values within those intervals in the specified field. 
+ In order to use Interval Faceting on a field, it is required that the field has “docValues” enabled. 
+ Even though the same functionality can be achieved by using facet query with range queries, the implementation of these two methods is very different and will provide different performance depending on the context. If you are concerned about the performance of your searches you should test with both options. Interval Faceting tends to be better with multiple intervals for the same fields, while facet query tend to be better in environments where cache is more effective (static indexes for example)
+ 
+ === facet.interval ===
+ This parameter Indicate the field where interval faceting must be applied. It can be used multiple time in the same request to indicate multiple fields. All the interval fields need to have docValues=“true” in the schema
+ {{{ 
+ &facet.interval=price&facet.interval=size
+ }}}
+ 
+ === facet.interval.set ===
+ This parameter is used to set the intervals for the field. This parameter can be specified multiple times to indicate multiple intervals. This parameter is global, which means that it will be used for all fields indicated with facet.interval unless there is an override for a specific field. To override this parameter on a specific field you can use: f.<fieldname>.facet.interval.set
+ {{{
+ &f.price.facet.interval.set=[0,10]&f.price.facet.interval.set=(10,100]
+ }}}
+ 
+ === Interval Syntax ===
+ Intervals must begin with either '(' or '[', be followed by the start value, then a comma ',', the end value, and finally ')' or ']’. 
+ 
+ For example:
+ 
+  * (1,10) -> will include values greater than 1 and lower than 10
+ 
+  * [1,10) -> will include values greater or equal to 1 and lower than 10
+ 
+  * [1,10] -> will include values greater or equal to 1 and lower or equal to 10
+ 
+ The initial and end values can't be empty, if the interval needs to be unbounded, the special character '*' can be used for both, start and end limit. When using '*', '(' and '[', and ')' and ']' will be treated equal. [*,*] will include all documents with a value in the field. The interval limits may be strings, there is no need to add quotes, all the text until the comma will be treated as the start limit, and the text after that will be the end limit, for example: [Buenos Aires,New York]. Keep in mind that a string-like comparison will be done to match documents in string intervals (case-sensitive). The comparator can't be changed. Commas, brackets and square brackets can be escaped by using '\' in front of them. Whitespaces before and after the values will be omitted. Start limit can't be grater than the end limit. Equal limits are allowed, this allows you to indicate the specific values that you want to count, like [A,A], [B,B] and [C,Z].
+ 
+ === Changing the interval Keys ===
+ Similar than with facet queries, with Interval Faceting the keys of the intervals can be changed by using the “key” LocalParam.
+ {{{
+ &f.price.facet.interval.set={!key=foo}[0,10]&f.price.facet.interval.set={!key=bar}[10,100]
+ }}}
+ 
+ 
  
  = Deprecated Parameters =
  == facet.zeros ==
@@ -573, +611 @@

  = Warming =
  facet.field queries using the term enumeration method can avoid the evaluation of some terms for greater efficiency. To force the evaluation of all terms for warming, the base query should match a single document.
  
+ == Interval Faceting ==
+ NOTE: make sure docValues="true" on the "price" field of your example schema before running this query
+ `http://localhost:8983/solr/select?q=*:*&facet=true&facet.interval=price&f.price.facet.interval.set=[0,10]&f.price.facet.interval.set=%2810,100]&f.price.facet.interval.set=%28100,*]`
+ {{{
+ ...
+ <lst name="facet_counts">
+   <lst name="facet_queries"/>
+   <lst name="facet_fields"/>
+   <lst name="facet_dates"/>
+   <lst name="facet_ranges"/>
+   <lst name="facet_intervals">
+     <lst name="price">
+       <int name="[0,10]">3</int>
+       <int name="(10,100]">4</int>
+       <int name="(100,*]">9</int>
+     </lst>
+   </lst>
+ </lst>
+ ...
+ }}}
+ === Changing the key per interval ===
+ `http://localhost:8983/solr/select?q=*:*&facet=true&facet.interval=price&f.price.facet.interval.set={!key='cheap'}[0,10]&f.price.facet.interval.set={!key='average'}%2810,100]&f.price.facet.interval.set={!key='expensive'}%28100,*]`
+ 
+ {{{
+ <lst name="facet_counts">
+   <lst name="facet_queries"/>
+   <lst name="facet_fields"/>
+   <lst name="facet_dates"/>
+   <lst name="facet_ranges"/>
+   <lst name="facet_intervals">
+     <lst name="price">
+       <int name="cheap">3</int>
+       <int name="average">4</int>
+       <int name="expensive">9</int>
+     </lst>
+   </lst>
+ </lst>
+ }}}
+