This issue is a crosspost from #1776534: Add support for using a Solr server with multiple sites #18 onwards.
Current Search API Solr multisite doesn't work. I'm typing out a recipe / proof of concept. Plus, we need a patch to tackle the problem that the site hash is being used hard-coded. This all needs to be tested.

The recipe includes a feature module and some steps to follow to reproduce the use case. Settings mentioned in the steps match the settings stored in the feature. If you need to test under different settings you'll need to override the feature to match the correct Solr core and host:port.

recipe

  1. Install a Solr 4 server:
    • that runs on localhost
    • with a core called multisite
    • accessible on port 8983
  2. install 2 drupal 7 sites
  3. enable the attached feature module on both sites (including necessary dependencies)
  4. generate or create some content on both sites which is uniquely identifiable
  5. index the content on: /admin/config/search/search_api/index/nodes
  6. check the permissions, the feature enforces a custom permission for authenticated users only
  7. clear the cache (just to be sure)
  8. the search page should be accessible on: /search/multisite
  9. execute a search on this page.
  10. if the search returns results, 2 facets should be visible: language and site hash, so you should be able to determine if multisite search is working

patch and feature module uploaded... patch merely comments out line 838 of search_api_solr/includes/service.inc

other stuff to do

  • Use a hook_search_api_solr_query_alter() implementation to remove the site hash filter or move the adding of the filter into its own method, to simplify overriding (@drunken monkey)
  • Rewrite the site hashes into friendly site names... like in apachesolr_multisite (with raw hashes the facets are unusable to end-users).
  • Find a way around node_access in the remote site. Can we presume user from site A is always an anonymous user to site B?
  • test in more complex setups (multisite + multilanguage + multi-index for instance)

Comments

drunken monkey’s picture

Use a hook_search_api_solr_query_alter() implementation to remove the site hash filter or move the adding of the filter into its own method, to simplify overriding (@drunken monkey)

Another approach would be to add a setting to the server enabling or disabling the site hash filter. If we provide a good description with it, it should be clear to users how they can change it.

Moving the adding of the filter to its own method could then be done additionally.

Find a way around node_access in the remote site. Can we presume user from site A is always an anonymous user to site B?

Probably that's the only viable option generally, without specific information about the sites in question. However, the other site might not even have "Node access" enabled, so this should probably be both configurable and easily pluggable.

OanaIlea’s picture

Status: Active » Closed (outdated)

This issue was closed due to lack of activity over a long period of time. If the issue is still acute for you, feel free to reopen it and describe the current state.