I am using apaceh solr and have altered taxonomy term links so that they are search facets from anywhere on the site using hook_url_outbound_alter(), FacetapiAdapter::getSearchPath() and FacetapiAdapter::getQueryString(), along with a custom function to run empty solr searches when necessary based a little on the code in #1252648: Allow for enabling facet blocks on non-search pages.
The aim is to only add facets using this method, and never remove them.
If I call FacetapiAdapter::getQueryString() with $active = 0 and the facet is already part of the search the resulting query contains that facet twice, exactly the same.
I'm sure I could get my code to do some checks and modifications to make sure this doesn't happen but it seems like it might be a bug in FacetapiAdapter::getQueryString() because in no case would you want a duplicate filter in the query string.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | facetapi-remove_duplicate_facets-1340528-2.patch | 665 bytes | rooby |
Comments
Comment #1
cpliakas commentedHi rooby.
Thanks for the detailed explanation. I think this is a bit of an edge case, however I do think that the API function should be able to handle this. It seems like the array_unique() function could be be applied to the
$qstring[$this->filterKey]array that is built towards the bottom of the FacetapiUrlProcessorStandard::getQueryString() method. Try that our and roll a patch if it works.Thanks,
Chris
Comment #2
rooby commentedThanks for the direction.
Here is a patch.
Comment #3
cpliakas commentedThanks for rolling the patch. This looks good to me!
Comment #4
cpliakas commentedCommitted at 0940443.
Congrats on becoming the 13th committer to Facet API!
Comment #5
rooby commentedThanks :)