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.

Comments

Darren Shelley’s picture

StatusFileSize
new4.96 KB

Please 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.

Darren Shelley’s picture

StatusFileSize
new4.94 KB

Reuploaded with '--no-prefix --relative' options to ease patch deployment with drush make.

pixelsweatshop’s picture

sub

jdanthinne’s picture

Status: Active » Needs review

Hi,
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.

simon georges’s picture

Status: Needs review » Fixed

I guess after more than one year, we can consider that as fixed ;-)
Please re-open if you have trouble with the SearchAPI integration.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.