Is there already a way to disable the multi-site search tab ?

Easier to explain why it's useful with an example : Say we create a set of websites dealing with a rock band tour. We have a main site that is a kind of portal for whole world, and one site by country with its own webmaster. Each webmaster adds events in his country site.
What we need : to be able to search for all events around the world when on the main world site, but only find the ones relating to the country when on a country site.
We need to share the same index, but to prevent the events from other countries to appear on a country site, we need to activate the multisite solr search module (to restrict the search to one site). However, we don't need to search across multiple sites when on a country site, so the tab is at least useless, or even undesirable if we want to prevent country users from accessing world content.

Thanks in advance,



Version:6.x-1.0-beta1» 6.x-1.x-dev

I've considered splitting the module to support this easily - patches welcome.


Status:Active» Needs review
new657 bytes
new2.08 KB

Well, what I did is quite easy but it should work. Not sure I splitted in the right way, I'm still kind of a newbie.

Status:Needs review» Needs work

This patch doesn't make sense - what's it supposed to be doing?

It does what I understood by "splitting the module". Some functions (the few ones relative to the Solr hash field) are moved to a new tiny module, for websites which use a shared index but do not have to return external nodes when searching.
To keep my example, the worldwide site would enable the tiny base module (which I called apachesolr_multisiteindex but it may be a bad name) plus the apachesolr_multisitesearch module. The country-specific websites would only install the tiny base module.
Doing so, when I'm searching for events on the french website, the usual "content" search tab would not return events that come from the spanish one (because of the restriction on the hash corresponding to the current site). When searching on the worldwide site, in the usual "content" tab, I would get only content from this site (in my example maybe nothing). But, as I enabled the multisitesearch module on this site, I would be able to use the alternative cross-site search tab, which would give me results from all over the world.
I hope my english is not too bad. Of course this patch is inseparable from the archive containing the tiny module which I attached too.

Ah, ok - maybe I was expecting it all together in one patch.

Status:Needs work» Needs review
new3.5 KB

Sorry, it wasn't clear. All is now in the same patch. As you can see, I just moved the two functions to a new module and added a dependency.

Maybe the best way to do would be :
- $query->add_filter('hash', apachesolr_site_hash()) by default in apachesolr_search
- if ($query->multisite) {$query->remove_filter('hash')} in apachesolr_multisite_search

However, it requires to patch two modules. And the hash filter on each query may take more time to retrieve results.

Or of course, there is the faster way to deal with that problem : simply add a checkbox in the multisite search administration to disable the multisite search tab on demand. That was my first idea, as the title of this subject says. The downside is : it requires to install the whole multisite search module on sites which just have to restrict search on current site hash.

Any opinion ?

I was considering the checkbox option also - except for the interaction with core search module. That make it harder, since you can't disable the hooks.

Thank you for your attention. What do you mean ? Which way to chose ? What is the problem with the hooks ?

Splitting the module at this point makes for an awkward upgrade path, no?

Status:Needs review» Needs work

OK. And what do you think of #8 ?

I was thinking about the checkbox option, not sure what pwolanin's concerns were with that route.

Hi to all.

I have some thing similar, but the difference is that I need that only can search by multisite... I mean, when a user search in the searchbox, then don't search in content and appear all of the other tabs... I need no tabs and only search with the multisite... I don't know if I explain???? I can't find the solution and I'm a little desperate...

Bruno Chávez

The search tab is provided by implementing a search module hook. In Drupal 6 there is no easy way to turn that tab off.

Well, do you have any information to help me to correct this...???

Hi... if you use tab tammer module, you can delete, deactivate, hide any tab...