You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2007/08/17 01:33:14 UTC

[Solr Wiki] Update of "SimpleFacetParameters" by HossMan

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

------------------------------------------------------------------------------
  
  = Parameters =
  
- These are the parameters used to drive the Simple Faceting behavior, note that some parameters may be overridden on a per-field basis with the following syntax:
+ These are the parameters used to drive the Simple Faceting behavior, grouped based on the type of faceting they support.
+ 
+ Note that many parameters may be overridden on a per-field basis with the following syntax:
  
     `f.<fieldName>.<originalParam>=<value>`
  
  eg. `f.category.facet.limit=5`
  
- 
  == facet ==
  
- Set to "true" this param enables facet counts in the query response. Any blank or missing value, or "false" will disable faceting.
+ Set to "true" this param enables facet counts in the query response. Any blank or missing value, or "false" will disable faceting.  None of the other parameters listed below will have any effect without setting this param to "true"
  
  The default value is blank.
  
- == facet.query ==
+ == Arbitrary Query Faceting: facet.query ==
  
  This param allows you to specify an arbitrary query in the Lucene default syntax to generate a facet count.  It can be particularly useful for numeric range based facets, or prefix based facets.
  
  This parameter can be specified multiple times to indicate that multiple queries should be used as separate facet constraints.
  
+ == Field Value Faceting Parameters ==
+ 
+ Several params can be used to trigger faceting based on the indexed Terms of a field.
+ 
+ When using this param, it is important to remember that "Term" is a very specific concept in Lucene -- it relates to the literal field/value pairs that are ''Indexed'' after any Analysis occurs.  For text fields that include stemming, or lowercasing, or word splitting you may not get what you expect.  If you want both Analysis (for searching) and Faceting on the full literal Strings, use copyField to create two versions of the field: one Text and one String.  Make sure both are `indexed="true"`
+ 
- == facet.field ==
+ === facet.field ===
  
  This param allows you to specify a field which should be treated as a facet.  It will iterate over each Term in the field and generate a facet count using that Term as the constraint.
  
- When using this param, it is important to remember that "Term" is a very specific concept in Lucene -- it relates to the literal field/value pairs that are ''Indexed'' after any Analysis occurs.  For text fields that include stemming, or lowercasing, or word splitting you may not get what you expect.  If you want both Analysis (for searching) and Faceting on the full literal Strings, use copyField to create two versions of the field: one Text and one String.  Make sure both are `indexed="true"`
- 
- 
  This parameter can be specified multiple times to indicate multiple facet fields.
  
+ None of the other params in this section will have any effect without specifying at least one field name using this param.
+ 
- == facet.prefix ==
+ === facet.prefix ===
  
  Limits the terms on which to facet to those starting with the give the given string prefix.  
  
@@ -45, +51 @@

  
  [Solr 1.2+]
  
- == facet.sort ==
+ === facet.sort ===
+ 
  Set to "true", this parameter indicates that constraints should be sorted by their count.
  If "false", facets will be in their natural index order (unicode).  For terms in the ascii range, this will be alphabetically sorted.  
  The default is true if facet.limit is greater than 0, false otherwise.
  
  This parameter can be specified on a per field basis.
  
- == facet.limit ==
+ === facet.limit ===
  
  This param indicates the maximum number of constraint counts that should be returned for the facet fields.  
  A negative value means unlimited.
@@ -61, +68 @@

  
  This parameter can be specified on a per field basis to indicate a separate limit for certain fields.
  
- == facet.offset ==
+ === facet.offset ===
  
  This param indicates an offset into the list of constraints to allow paging.
  
@@ -71, +78 @@

  
  [Solr 1.2+]
  
- == facet.mincount ==
+ === facet.mincount ===
  
  This param indicates the minimum counts for facet fields should be included in the response.
  
@@ -81, +88 @@

  
  [Solr 1.2+]
  
- == facet.missing ==
+ === facet.missing ===
  
  Set to "true" this param indicates that in addition to the Term based constraints of a facet field, a count of all matching results which have no value for the field should be computed
  
@@ -89, +96 @@

  
  This parameter can be specified on a per field basis.
  
- == facet.enum.cache.minDf ==
+ === facet.enum.cache.minDf ===
+ 
  This param indicates the minimum document frequency (number of documents matching a term) for which the filterCache should be used when determining the constraint count for that term.  This is only used during
  the term enumeration method of faceting (facet.field type faceting on multi-valued or full-text fields).
  
@@ -102, +110 @@

  
  [Solr 1.2+]
  
+ == Date Faceting Parameters ==
+ 
+ Several params can be used to trigger faceting based on Date ranges computed using simple DateMathParser expressions.
+ 
+ When using Date Faceting, the {{{facet.date}}}, {{{facet.date.start}}}, {{{facet.date.end}}}, and {{{facet.date.gap}}} params are all mandatory...
+ 
+ === facet.date ===
+ 
+ This param allows you to specify names of fields (of type DateField) which should be treated as date facets.
+ 
+ This parameter can be specified multiple times to indicate multiple date facet fields.
+ 
+ === facet.date.start ===
+ 
+ The lower bound for the first date range for all Date Faceting on this field.  This should be a single date expression which may use the DateMathParser syntax.
+ 
+ This parameter can be specified on a per field basis.
+ 
+ === facet.date.end ===
+ 
+ The minimum upper bound for the last date range for all Date Faceting on this field (see {{{facet.date.hardend}}} for an explanation of what the actual end value may be greater).  This should be a single date expression which may use the DateMathParser syntax.
+ 
+ This parameter can be specified on a per field basis.
+ 
+ === facet.date.gap ===
+ 
+ The size of each date range expressed as an interval to be added to the lower bound using the DateMathParser syntax.
+ 
+ Example: {{{facet.date.gap=%2B1DAY}}}  (+1DAY)
+ 
+ This parameter can be specified on a per field basis.
+ 
+ === facet.date.hardend ===
+ 
+ A Boolean parameter instructing Solr what do do in the event that {{{facet.date.gap}}} does not divide evenly between {{{facet.date.start}}} and {{{facet.date.end}}}.  If this is true, the last date range constraint will have an upper bound of {{{facet.date.end}}}; if false, the last date range will have the smallest possible upper bound greater then {{{facet.date.end}}} such that the range is exactly {{{facet.date.gap}}} wide.
+ 
+ The default is false.
+ 
+ This parameter can be specified on a per field basis.
+ 
+ === facet.date.other ===
+ 
+ This param indicates that in addition to the counts for each date range constraint between {{{facet.date.start}}} and {{{facet.date.end}}}, counts should also be computed for...
+ 
+    * {{{before}}} all records with field values lower then lower bound of the first range
+    * {{{after}}} all records with field values greater then the upper bound of the last range
+    * {{{between}}} all records with field values between the start and end bounds of all ranges
+    * {{{none}}} compute none of this information
+    * {{{all}}} shortcut for {{{before}}}, {{{between}}}, and {{{after}}}
+ 
+ This parameter can be specified on a per field basis.
+ 
+ In addition to the {{{all}}} option, this parameter can be specified multiple times to indicate multiple choices -- but {{{none}}} will override all other options.
+ 
- = Deprecated parameters =
+ = Deprecated Parameters =
+ 
  == facet.zeros ==
  
  Set to "true" this param indicates that constraint counts for facet fields should be included even if the count is "0", set to "false" or blank and the "0" counts will be suppressed to save on the amount of data returned in the response.
@@ -284, +347 @@

  	 'xxvi',1] } } }
  }}}
  
+ 
+ == Date Faceting: per day for the past 5 days ==
+ `http://localhost:8983/solr/select/?q=*:*&rows=0&facet=true&facet.date=timestamp&facet.date.start=NOW/DAY-5DAYS&facet.date.end=NOW/DAY%2B1DAY&facet.date.gap=%2B1DAY`
+ 
+ {{{
+ <response>
+ <lst name="responseHeader">
+  <int name="status">0</int>
+  <int name="QTime">5</int>
+  <lst name="params">
+   <str name="facet.date">timestamp</str>
+   <str name="facet.date.end">NOW/DAY+1DAY</str>
+   <str name="facet.date.gap">+1DAY</str>
+   <str name="rows">0</str>
+   <str name="facet">true</str>
+   <str name="facet.date.start">NOW/DAY-5DAYS</str>
+   <str name="indent">true</str>
+   <str name="q">*:*</str>
+  </lst>
+ </lst>
+ <result name="response" numFound="42" start="0"/>
+ <lst name="facet_counts">
+  <lst name="facet_queries"/>
+  <lst name="facet_fields"/>
+  <lst name="facet_dates">
+   <lst name="timestamp">
+         <int name="2007-08-11T00:00:00.000Z">1</int>
+         <int name="2007-08-12T00:00:00.000Z">5</int>
+         <int name="2007-08-13T00:00:00.000Z">3</int>
+         <int name="2007-08-14T00:00:00.000Z">7</int>
+         <int name="2007-08-15T00:00:00.000Z">2</int>
+         <int name="2007-08-16T00:00:00.000Z">16</int>
+         <str name="gap">+1DAY</str>
+         <date name="end">2007-08-17T00:00:00Z</date>
+   </lst>
+  </lst>
+ </lst>
+ </response>
+ }}}
  = Warming =
  
  facet.field queries using the term enumeration method can avoid the evaluation of some terms for greater efficiency.