On The Guardian's website (UK newspaper), they're also using a faceted search. When you click on a facet to filter by, it gets added to an 'Active filters' block. When you click on another facet, it gets added to the same block etc etc.

The advantage I see is this: instead of having the active filters spread out over several blocks, the user sees one block with all the active filters, which makes the filtering process (clicking and unclicking facets) more clear, imho. On the other hand, the approach we currently use, makes it clear which kind of filter you're dealing with.

You can try it out at http://browse.guardian.co.uk/search?search_target=%2Fsearch&fr=cb-guardi...

Should we group active facets together in one block? Or not?

CommentFileSizeAuthor
#6 current_search_block.jpg43.41 KBjanusman

Comments

xnickmx’s picture

I like the idea of having all the active facets grouped together in one block.

pwolanin’s picture

this is already done in the 6.x version.

JacobSingh’s picture

It is? I don't think so. I think he's talking about what Jeff suggested.

xnickmx’s picture

As far as I can tell, in 6.x, the facets are spread out across different blocks. These are all separate blocks:

  • Apache Solr Search: Current search
  • Apache Solr Core: Sorting
  • Apache Solr Search: Filter by author
  • Apache Solr Search: Filter by content type

I like the option of having them in separate blocks, but it would be nice to be able to put everything into one block as well, as brunodbo suggests.

janusman’s picture

Again, faceted_search module has "been there" =) It groups facets into a single block, and a single admin page manages the block names, the order to show them, or whether to hide them.

Comparing both modules, I think the end product is almost the same. Apache Solr offers a bit more flexibility (spreading out facets among different regions, and more options for theming perhaps?), but is also much more lengthy to setup.

janusman’s picture

StatusFileSize
new43.41 KB

I apologize; I commented on having the available facets in a single block, and not the active facets.

@pwolanin is right, there is a "Current search" block that shows only the active facets and keyword search in one block. Attached is a sample image from current 6.x-1.x-DEV

janusman’s picture

Should this be marked as duplicate, since it'll be resolved as/when the D5 backport is done?

davidwhthomas’s picture

Version: 5.x-1.0-beta2 » 6.x-1.0-rc1

If anyone is interested in combining all facets into a single block, I implemented that using the D6 version

The key theme function to build the combined facet block is

<?php
/**
 * @ingroup themeable
 * Collect and return all enabled search facet blocks in a single block
 */
function theme_engage_search_grouped_facets_block(){
  // Get information on available enabled facets
  $enabled_facets = apachesolr_get_enabled_facets('apachesolr_search');
  $facets = apachesolr_search_apachesolr_facets();
  // Get the facet block content
  $content = array();
  foreach ($enabled_facets as $delta => $facet_field) {
    if (isset($facets[$delta])) {
      // Invoke apachesolr_search to get the block content for this delta.
      $facet_block = module_invoke('apachesolr_search', 'block', 'view', $delta);
      if( ! empty($facet_block['content']) ){
        // If it has facet content, add it
        $content[] = theme('box', $facet_block['subject'], $facet_block['content']);
      }
    }
  }
  // Build return block
  $block['subject'] = t('Refine Search');
  $block['content'] = implode("\n", $content); // newline separated
  return $block;
}
?>

I called it from a hook_block implementation to provide an extra combined facet block.

DT

jpmckinney’s picture

Status: Active » Closed (won't fix)

Selected filters are already grouped in the currentsearch block. If you want to remove selected filters from facet blocks, implement theme_apachesolr_facet_list (or write a contrib module to do the same). I am against adding theming features to the module.

davidwhthomas’s picture

The function in #8 just creates an extra block that combines available facets into one block.
Normally apachesolr facets are in multiple blocks.
It's different from the 'current search' block in that it shows available and selected facets, not just selected facets.
It's here if anyone needs that feature.
DT

jpmckinney’s picture

Aha, right. I was replying to the issue title, and hadn't noticed there was discussion here about having a single block with all the facets. In any case, I still don't think this module should be responsible for providing the myriad possible UIs people may want for their sites. It should provide a unique, basic UI, and offer developers every opportunity to customize/override it.