VeggieMeat / search_api_elasticsearch

Clone of project at drupal.org/project/search_api_elasticsearch for better CI options than what D.O offers
16 stars 8 forks source link

Integration with search_api_multisearch for multi-index searches #80

Open VeggieMeat opened 9 years ago

VeggieMeat commented 9 years ago

Original issue: https://www.drupal.org/node/2510246

Problem/Motivation

A client of mine wants to use Elasticsearch to perform a search that involves multiple Elasticsearch indexes -- indexes from two separate Drupal sites, and perhaps a third site that isn't even Drupal.

In order to do this, I think we need to do the following:

a) Install search_api_elasticsearch on both Drupal sites.

b) Apply the patch from #2169931-1: Users should be able to define index names so that on site A, I can set up a read-only index that references the index from site B. That patch is needed so that I have control over what the machine name of the index is on the actual Elasticsearch server.

c) Set up an Elasticsearch index on site A and on site B (we want a separate index for each one, for other reasons), and on site A, also set up a read-only index that references the index on site B.

d) Install search_api_multisite... Well here is where it fails, because right now this module is not integrated with Search API Multisite.

Proposed resolution

I read the API docs for Search API Multisite, and it looks like all we need to do is make it so that the class that implements SearchApiServiceInterface has an additional method searchMultiple() added to it (the method from SearchApiMultiServiceInterface, but not a direct implement of this method).

I'm going to attempt a patch, and either report back that it worked and attach a patch, or else be very sad. It should be straightforward, since the Elastica classes themselves do support multiple index searches.

Remaining tasks

Make patch, test, and add to module. It will go into the Elastica sub-module, in search_api_elasticsearch/modules/elastica/includes/SearchApiElasticsearchElastica.inc

Also apply the patch from #2169931-1: Users should be able to define index names or something similar, so that you can add a read-only index to site A with a definite machine name, in order to pick up the index from site B.

User interface changes

Elasticsearch will be usable in multi-index mode.

API changes

SearchApiElasticsearchElastica.inc will have a new searchMultiple method on it.

Data model changes

None.