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,

Gaël

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pwolanin’s picture

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

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

yngens’s picture

subscribe

GaëlG’s picture

Status: Active » Needs review
FileSize
657 bytes
2.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.

pwolanin’s picture

Status: Needs review » Needs work

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

GaëlG’s picture

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.

pwolanin’s picture

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

GaëlG’s picture

Status: Needs work » Needs review
FileSize
3.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.

GaëlG’s picture

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 ?

pwolanin’s picture

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.

GaëlG’s picture

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

jpmckinney’s picture

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

jpmckinney’s picture

Status: Needs review » Needs work
GaëlG’s picture

OK. And what do you think of #8 ?

jpmckinney’s picture

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

bchavez’s picture

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

Regards
Bruno Chávez

pwolanin’s picture

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

bchavez’s picture

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

bchavez’s picture

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

janusman’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)