great module I wander why only 264 sites are using it. By the way I'm working in a use case where there is a big ecosystem of multiple independents sites where some groups of sites are related under one category but that categories may have a hierarchy:

  • Cultura
    • Museums
      • Museum 1
      • Museum 2
    • Theatre
      • Theatre 1
      • Theatre 2

In this scenario we need to search at different levels: locally in each site (ig. Museum1), multisite in a group of sites (ie. Museums, not necessary a tee branch), and globally in all sites (Cutura). this module resolve the first and the last scenario.

I think it would be useful to include the feature to search in a set of sites.

Members fund testing for the Drupal project. Drupal Association Learn more


mscalone’s picture

two possibilities I figured out:

  1. simple: select (in the multistite search configuration tab) the sites to search in when you are in multisite search mode. Just adding a checkbox near each site fetched from the index. All the configuration remains in the site but must be updated when new site is added to the category
  2. more complicated: add the ability to define groups of sites and keep that information in the index. One simple way to achieve that is by adding an extra field to the site metadata (for example sm_site_category). then use this field to get al site hashes tagged under some category and include in default filter. Then add a list of site-categories to search in.

What do you think?

I think I'm going to make some tests with the second option.

thePanz’s picture

Solution #3: override multisite hooks to add in each indexed document also the site-category.
finally add such site-category as a search facet.

my 2 cents

mscalone’s picture

That's a great idea because its less invasive and simpler, but unfortunately multisite search does not seems to expose any hook. Anyway it's possible to do the same implementing hooks from apachesolr and check whether apachesolr_miltisitesearch its enabled or not.

When I request the feature (one year ago) I was thinking in a modification to the apachesolr_miltisitesearch module, I thought it more adequate. But it does not seem to be a very requested feature by the community, maybe it's better to separate it into a different module.

I'll think about it, thanks

Dave Reid’s picture

Issue summary: View changes
Status: Active » Needs review
2.75 KB

I actually wanted this feature because I need the multisite search, but only only wanted to query select sites, but not just the local site or all of the multisites. Patch ready for review.

Dave Reid’s picture

Revised patch with some cleaned up logic and a helper function to retrieve the option array of multisite hashes since it's now used more than once.

pwolanin’s picture

Looks like a good start.

I might name the environment variable something like _sites instead of _hashes, since the "hash" name was kind of jus a dumb choice on my parts\ several years ago (when it started out as a hash of the site URL). It's really like a site ID or machine name.

Instead of the doing a raw string construction + implode we might want to use the subquery class like the apachesolr_access module:

    $subquery = apachesolr_access_build_subquery($user);

The subquery comes from calling function apachesolr_drupal_subquery().

Dave Reid’s picture

Thanks for the feedback, those all sound like good improvements! Renamed things from 'hashes' to 'sites' and added a helper function apachesolr_multisitesearch_build_site_subquery() which uses a proper subquery object.

Dave Reid’s picture

Missed one $hash variable should have been $site.

Dave Reid’s picture

Shouldn't had moved around the ->addParam() calls.

Dave Reid’s picture

Shouldn't patch too late at night.

xtfer’s picture

madhusudanmca’s picture

Status: Needs review » Needs work


Many thanks for providing the patch. It looks good to me!!

However I still have one concern with this module since beginning, as indexed sites listed (to be searched or to delete index) some time show actual sites URL (like: http://examlple.com) and some times it's hash value (like: o792hb). Showing hash value of site make it very difficult to read, which site we are referring.
Can we get rid of this issue?


Dave Reid’s picture

Status: Needs work » Needs review

@madhusudanmca the same behavior happens without this patch as well, so no need to push it down to needs work for that.

madhusudanmca’s picture

Hi Dave Reid,

Excuse me for putting it to "needs work", I thought that that you are the one of maintainers of this module!!

Actually for two of our clients I also wrote the custom code for having sites specific search in a multisite search environment using Apache SOLR hooks.

It'll be nice if we can have that in "Apache Solr Multisite Search" module itself.
This patch looks good to me except that site URL mash!!


Dave Reid’s picture

Revised patch that ensures the current site is always listed in the box of options (in case the metadata hasn't been refreshed before hitting the edit Solr environment page).

  • Commit d4502d3 on 7.x-1.x by Dave Reid:
    Issue #1909668: Added ability to select certain multisites to include in...
Dave Reid’s picture

Status: Needs review » Fixed

Committed #15 to 7.x-1.x.

Status: Fixed » Closed (fixed)

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

tjmoyer’s picture

Does this, by any chance, resolve this issues as well: Bundle exclusion breaks when indexed bundles change? We're having trouble with the exclusions list changing, causing search to be unavaliable.