I've been playing with the 'apachesolr_examples' project [1] to get apachesolr [2] to search an 'external' (non-Drupal content derived) Solr index. This is working great, and even allows me to build facets for the fields of my choice, which show up nicely as blocks on the search page.
However, when I subsequently install the Current Search Blocks (CSB) module in the Facet API project, the CSB seems to 'clobber' the facet blocks. The blocks disappear from the admin/structure/block list (and from the search page). Weirdly, the facet config tab of the external index changes from listing only those facets defined in the code to the 'full' set of facetable fields in the 'default' apachesolr index schema.
[1] http://drupal.org/project/apachesolr_examples
[2] http://drupal.org/project/apachesolr
STEPS TO REPRODUCE
* Start with a new Drupal install.
* Download and install ctools
* Download and install facet_api
* Download the latest development version of apachesolr
* Download the latest development version of apachesolr_examples
* See the facet blocks. Look at the default 'external index' and notice the facets.
* Enable Current Search Blocks.
* Notice the absence of the facet blocks. The facets for the default 'external index' have now changed.
* Cry.
If I laboriously uninstall apachesolr_examples, facet_api, and apachesolr, I can repeat the above ad-nauseum.
Comments
Comment #1
dbolser commentedOut of interest, if I install apachesolr_examples after installing CSB, I see both the CSB and specific external facet blocks. However, when I next clear the cache the facet blocks disappear as before.
Comment #2
cpliakas commentedThere's no crying in Drupal. OK, maybe a little crying. Thanks for the detailed steps, and I will try to reproduce.
Thanks!
Chris
Comment #3
dbolser commentedMany thanks Chris, I probably only wept a little ;-)
I was searching the code to try to understand how the two modules hook into the blocks, where there may be conflicts. Am I right in thinking that the facetapi code has some lines to delete all facet blocks before registering them?
Does the apachesolr_examples code register the blocks correctly?
Thanks for any hints you can give (I'm very new to Drupal, but I know PHP a little).
Cheers,
Dan.
Comment #4
dbolser commentedVery sorry, I've now got a set of steps that recreates the problem with disappearing facets that doesn't involve facetapi!
Basically, whenever I clear the cache after installing apachesolr_examples, the facets it defines dissapear, and are overwritten by the 'default' apachesolr defined facets. i.e. it's a conflict between those two modules, with nothing to do (directly) with facetapi!
Sorry again,
Dan.
Comment #5
cpliakas commentedDan,
Thanks for the details. I am actually going to keep this open because given that information I am not convinced that Facet API doesn't have something to do with it. The block definition and caching strategy can be a bit wonky at times, so I want to make 100% sure that it works well with Apache Solr Examples.
Thanks,
Chris
Comment #6
dbolser commentedCool.
Here is the bug (and the nominal fix) that I submitted to the Apache Solr Examples project:
http://drupal.org/node/1734478
As far as I can tell, the issue comes from apachesolr searching through all content types and registering all facetable fields in all search environments. Examples was trying to be clever and restrict it's facets to its (explicitly named) search environment, but that strategy ended up backfiring, with the facets going missing.
My 'fix' ensures all facets are shown in all environments, which isn't ideal, but at least doesn't break what I need to do.
Comment #7
cpliakas commentedThanks for all the details. As you mentioned, this is probably a won't fix on Facet APIs side. Let's continue fixing in the examples project.