Looking at the Google search results page (see attached screenshot), the facets for "Everything", "Images", etc have images next to them. Although this is possible with Facet API, it requires custom coding and hooking into the widget layer which is a PITA for such a simple task. The great part of the Field API in D7 is the ability attach things such as images to items such as taxonomy terms, and there should be an easy way to render this metadata in facet displays. The way that jumps out at me is leveraging Views.

How I see this working is by adding a Contextual Filter that allows you to pull the facet data returned by the search server so you can build your faceted interfaces using a familiar GUI. Each "block" would be a different View and would have the appropriate base table. The site builder would then add a contextual filter pulling from the appropriate facet field.

CommentFileSizeAuthor
#2 facet-api-attributes.png6.79 KBebeyrent
#1 facet-images.jpg131.8 KBcpliakas
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cpliakas’s picture

FileSize
131.8 KB

Forgot to add screenshot.

ebeyrent’s picture

FileSize
6.79 KB

Another approach would be to do what the Menu Attributes module does, allowing users to set attributes in the interface such as class or id. Facet API could do something similar, so that the images could be set in CSS with sprites or individual background images.

cpliakas’s picture

Very interesting approach.

So we are proposing two systems here. One is the widget system that currently exists in Facet API. I think that the approach mentioned in #2 above would be perfect for that, and could definitely solve the image problem without having to leverage Views.

The second system is Views integration, which in addition to something simple could also hook into a charting / graphing modules for Views and do some really interesting displays. That way I could get out of maintaining a "Chart Facets" module :-).

Thanks for the great idea!

ebeyrent’s picture

Totally agreed. It would rock to be able to display a block of taxonomy facets as a bar graph or the like.

klonos’s picture

cpliakas’s picture

Category: task » feature
Priority: Major » Normal

Lowering priority since this could be implemented in a separate contrib, also bumping to a feature request for the same reason.

cpliakas’s picture

Component: Code » Contrib

Adding to the Contrib component, which means that I am looking for this functionality to be added outside of this module in a separate contrib.

SergeyR’s picture

As for facets with images -one possibility is to put image html tag to field value list.
It works with apache solr integration and recently realized at search api too (see link)

http://drupal.org/node/1343642

danielnolde’s picture

Title: Views integration » Render facet items via views (aka "Views integration")
Georgique’s picture

Subscribe

Georgique’s picture

In case of coming here from http://drupal.org/node/1477836, my request is an opportunity to use facetapi facets instead of views exposed filters. I want it because:
1. Values in facets are limited by view result. For example if I had in view result only publications with author A, I want to see in author's filter only this author A.
2. Facets display counts of values.
This features not work in views exposed filters.

iajay’s picture

subscribe

bago’s picture

I landed here from http://drupal.org/node/1274086

Rendering the facets using a view has nothing to do with letting views know about filters applied by facets.

So, if you prefer to keep open a single issue about every kind of task related to "views" at least the subject should reflect this (it currently make it clear this is about rendering the facets using views and not the other kind of integrations).

cpliakas’s picture

Some more ideas posted at #1797616: Marry facets and Views exposed filters regarding normalizing the Facet API paths with how Views exposed filter links are constructed.

Mod74’s picture

Issue summary: View changes

So...this rather crucial integration doesn't work because of a disagreement in the way URLs are created and the contrib idea has been abandoned?

NWOM’s picture

It would also be extremely beneficial when it comes to performance. Whenever a facet is submitted, on an already loaded view, it refreshes the entire view (with no filters), and then applies the Faceted filter. If both projects were to marry, then applying a filter on an already loaded view would re-load the view with the facet filter already in place. I hope that makes sense.

NWOM’s picture

Status: Active » Closed (duplicate)
Related issues: +#1797616: Marry facets and Views exposed filters

Marking as duplicate since the maintainer said that it would need to be handled via a contrib module here:#1797616: Marry facets and Views exposed filters. However thankfully a contrib module is in the works: https://www.drupal.org/project/facetapi_views