Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
There is a pending change at #1252644: Remove assumption that the facets will link back to the page they are on that could effect Facet API integration. In order to maintain backwards compatibility with the Apache Solr and Faceted Navigation for Search projects, I have to default to an implementation that works with those two solutions. Search API's adapter will need to override FacetapiAdapter::getSearchPath() in order to set the correct path for the search.
Comment | File | Size | Author |
---|---|---|---|
#3 | search_api-1263386-3.patch | 628 bytes | cpliakas |
Comments
Comment #1
cpliakas CreditAttribution: cpliakas commentedQuestion to Thomas...
In terms of the Search API module, what is the best way to get the base path for the search? Any guidance you can give as to which API functions are available would be helpful.
Thanks,
Chris
Comment #2
drunken monkeyBasically, there is none. There isn't even a method to find all searches defined on a site, let alone where they are or how they pass the search keys.
Apart from defaulting to
$_GET['q']
, I think the only thing we could do here (if this is important to differentiate) is allowing to override this default via a certain query object option (which, e.g., Search pages could then use).But how would that work? Would facets then link to that base path plus their GET parameter? Then
$_GET['q']
would be correct in all current cases anyways – save for the "Facets block" Views display which I'll have to hack together anyways, probably.Comment #3
cpliakas CreditAttribution: cpliakas commentedGET['q'] is perfectly fine. The use case for getting the path is the case where facets should be displayed on the home page to initiate a search. Definitely not required, and something that the Search API module would have to do the heavy lifting for if this functionality were to be added later. Refer to the patch against Apache Solr at #1252648: Allow for enabling facet blocks on non-search pages for an example.
I attached a very complex, mind bending patch for this.
Thanks,
Chris
Comment #4
drunken monkeyWoah, awesome work! I don't think I grasp all of this in full detail, but what I can understand looks fine. Extensive testing also showed no bugs, so this should be RTBC.
And yeah, we can go back and add some other mechanism in there later, if we can come up with something. The Views „Facets block“ display actually does this, but I think it'll be easier to code the facet listing myself for that.
Hm, or maybe I'll edit that then and really introduce a base path query option. This would allow you to just activate the facet blocks you want and be done with it …
Comment #5
cpliakas CreditAttribution: cpliakas commentedThanks for the feedback. Committed at e361465.