I've recently started using the D7 'Search API' module to handle my search integration needs in Drupal. I've chosen this particular module for a number of reasons including its handler-agnostic approach and its integration with Views.
It would be great if 'Custom Search' could add 'Search API' to the growing list of supported modules (google_appliance, lucenapi,apachesolr_search).
I have attempted to integrate the two solutions as is (without patching), and have had varying degrees of success.
The particular component I am most interested in harnessing in my sites setup is the rather flexible 'Custom Search Block'. However, this function is limited currently by its necessity to bundle terms in the URL/Query structure.
A typical search path:
http://www.example.com/search/keys?terms=5+6
A Search API Faceted Search Path (using a panel on the path 'search')
http://www.example.com/search?keys=keyword&filter[field_hub][0]="5"&filter[field_keystage][1]="6"
Notice that in the above example vocabulary terms are distinct, meaning a single [terms] keyword is insufficient.
To be most flexible, I suggest allowing a custom search suffix per taxonomy which could form part of the block settings.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | search_api_support-1145660-2.patch | 4.94 KB | Darren Shelley |
| #1 | search_api_support-1145660-1.patch | 4.96 KB | Darren Shelley |
Comments
Comment #1
Darren Shelley commentedPlease find attached a patch which attempts to address the issue by adding a "Custom Search Path Suffix" field to each taxonomy term.
Using the patch, we can now integrate with the example URL.
A form submission to the path:
http://www.example.com/search?keys=keyword&filter[field_hub][0]="5"&filter[field_keystage][1]="6"
Could be achieved by setting a blocks "custom search paths" to:
search/?keys=[key]|Whole Site
Setting the hubs taxonomy 'Custom Search Path Suffix' to:
&filter[field_hub][0]="[vterms]"
And Setting the keystage taxonomy 'Custom Search Path Suffix' to:
&filter[field_keystage][1]="[vterms]"
([vterms] being the vocabulary specific terms in this instant)
This patch will allow minimal use of custom search blocks with a 'Search API' setup, and hopefully will make the module more compatible with other search integrations.
This is my first patch in the drupal community, feedback would be greatly appreciated.
Comment #2
Darren Shelley commentedReuploaded with '--no-prefix --relative' options to ease patch deployment with drush make.
Comment #3
pixelsweatshop commentedsub
Comment #4
jdanthinne commentedHi,
I've taken some time to understand how Search API was working,
and I've come up with a better solution (yours was fine but a bit tricky for users to configure).
So, if you download the next DEV version (from 19th+ September), you'll see in the Custom Search settings (/admin/config/search/custom_search) a new "Search API" field where you can choose the Search Page to redirect the default search… and that's it. Content type and Terms will be added automatically to the path.
Please test and review.
Comment #5
simon georges commentedI guess after more than one year, we can consider that as fixed ;-)
Please re-open if you have trouble with the SearchAPI integration.