You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Tim Jones <ti...@jitterjam.com> on 2010/11/19 15:52:05 UTC

Use of "key" in facets

Hi,
  I'm curious about the use of the "key" option with regard to facets.  I've
been treating it as a way to alias fields and queries in order to simplify
processing of result sets and generally make them more readable.  However it
seems that the alias is not respected when setting mincount, sort, etc
options for a particular facet.  The following example works fine with
1.4.1.

rows=0&q=*:*+NOT+customers.blocked:1&facet=true&f.customers_name.facet.mincount=2&facet.field=customers_name

<lst name="customers_name">
  <int name="jone">2</int>
</lst>

This version also works fine.  Note the addition of the key but keep in mind
that the original field name is still being used in the
f.customer_name.facet.mincount parameter.

rows=0&q=*:*+NOT+customers.blocked:1&facet=true&f.customers_name.facet.mincount=2&facet.field={!key=alt_name}customers_name

<lst name="customers_name">
  <int name="jone">2</int>
</lst>

This version does not work.  Now the key is being used in the facet
parameter (e.g. f.alt_name.facet.mincount).

rows=0&q=*:*+NOT+customers.blocked:1&facet=true&f.alt_name.facet.mincount=2&facet.field={!key=alt_name}customers_name

<lst name="alt_name">
  <int name="jone">2</int>
  <int name="tim">1</int>
  <int name="sami">0</int>
</lst>

What is the intended behavior of key in this case?  If it's really intended
to be an alias then it seems like it should work in these situations.  Am I
misunderstanding the meaning of key?

Thanks,
-Tim