Move solr_get_facets to a system.inc.php call
libsys - November 30, 2007 - 16:49
| Project: | Solr |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | hickory |
| Status: | active |
Jump to:
Description
I think I'd prefer to have the facet block call moved into solr_system.inc to so that I can modify the facet parameters and call my own theme function w/out having to touch solr.module. So...
change
function solr_block($op = 'list', $delta = 0, $edit = array()) {
...
case 0:
if (arg(0) == 'search' && $_GET['t']){
return solr_get_facets(arg(1), $_GET['t'], $_GET['fq']);
}
break;
...
}to
function solr_block($op = 'list', $delta = 0, $edit = array()) {
...
case 0:
return node_invoke($type, 'solr_get_facets', $_GET['t'], $_GET['fq']);
break;
...
}and then stick your arg()s and conditional in the footype_solr_get_facets function. Something like:
function footype_solr_get_facets($keys, $fq = NULL){
if (arg(0) == 'search' && $_GET['t']){
$type = arg(1);what say you?
-Thanks.

#1
Not solr_system.inc, because that only contains functions that are replacements for core functions. "get_facets" could certainly be moved into hook_solr though.
#2
Which parts of solr_get_facets do you need to change per content type?
#3
Primarily, I need to call an alternate theme function to theme_solr_facet (ex I've added some JS slide-outs to my facets) and I also need to be able to set the facet parameters. In terms of theming, I *could* just alter theme_solr_facet, but I am in the habit of keeping the "stock" themes in solr.theme.inc for reference. Gaining direct access to the facet parameters is a must for me in any case.
A sort of secondary issue is that I have a couple of additional conditions that I need to test for before showing facets (ex I have a "browse" page with all results from the database as well as a default search page w/no results and no facets). I suppose I could stick these conditions directly into the block (PHP) visibility settings, but I'd prefer to keep them in the config files with everything else.
Thanks...