CCK has a feature where integer fields can have a textual label in select lists and during rendering. We should support these sort of integer fields as facets.

Comments

moshe weitzman’s picture

Would the maintainers accept a patch for this?

JacobSingh’s picture

Absolutely!

janusman’s picture

I would suggest that integers-as-facets can be involved in different use cases:
* Datestamps are clustered together into years/months/weeks/days/hours at different levels of specificity.
* Ages could be clustered into evenly-divided ranges (0-9, 10-19, 20-29, 30-higher)
* Numbers could just mean "group 1", "group 2", etc. with no clustering/grouping whatsoever.

I seems to me we would benefit by having a generic way to offer modules hooks to cluster items using Solr ranged queries.

Or am I dreaming? =)

jpmckinney’s picture

Title: Integer based facets » API support for ranged queries in facets
Version: 6.x-1.x-dev » 7.x-1.x-dev

Better support for ranged queries is a good idea.

pwolanin’s picture

Project: Apache Solr Search » Facet API
Version: 7.x-1.x-dev »
cpliakas’s picture

Version: » 7.x-1.x-dev

Facet API has the concept of "query type" plugins. The query types implemented by Apache Solr will be "term", "date", and "range". Therefore this will be supported via the Facet API module.

pwolanin’s picture

Per skype call w/ Chris, we might need an API change:

  'query type' => 'term',

becomes

  'query types' => array('term'),

We'd add a new query type, something like 'range filter' to support the a range slider plugin without actually generating range facets.

We need to use http://wiki.apache.org/solr/StatsComponent to get min/max within the range (depending on user prefs)

cpliakas’s picture

As per the comment above, a task has been posted at #1161434: Modify "query type" key in facet definition to accept an array. A corresponding task has been posted against Apache Solr at #1161444: Modify Facet API field definitions to reflect API change for the "query type" key.

dynamicdan’s picture

+1 ... I would make great use of this and therefore help test it.

zambrey’s picture

Subscribing.

Anonymous’s picture

+1

cpliakas’s picture

So just an architectural note here, Facet API is simply a facilitator here and already has an API that supports ranges queries (and any other queries) through it's query type plugin system. Each backend will have to create a query type plugin for range queries, so there is no stopping people from implementing this is Search API / Apache Solr. In terms of what Facet API has to do, it just has to figure out a way to associate multiple types with a single field in a way that won't confuse the UI.

cpliakas’s picture

Component: Code » Code (functionality)
Status: Active » Closed (fixed)

Marking as fixed since Apace Solr Search Integration added this functionality at #1161444: Modify Facet API field definitions to reflect API change for the "query type" key. For technical specifics, look at the ApacheSolrFacetapiNumericRange class in the patch posted at http://drupal.org/node/1161444#comment-5227496 to see how range support was added in a way that is works with Facet API.