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
Comment | File | Size | Author |
---|---|---|---|
#7 | apachesolr_multisitesearch-939262.patch | 3.5 KB | GaëlG |
#3 | apachesolr_multisitesearch-939262.patch | 2.08 KB | GaëlG |
#3 | apachesolr_multisiteindex.tar_.gz | 657 bytes | GaëlG |
Comments
Comment #1
pwolanin CreditAttribution: pwolanin commentedI've considered splitting the module to support this easily - patches welcome.
Comment #2
yngens CreditAttribution: yngens commentedsubscribe
Comment #3
GaëlGWell, 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.
Comment #4
pwolanin CreditAttribution: pwolanin commentedThis patch doesn't make sense - what's it supposed to be doing?
Comment #5
GaëlGIt 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.
Comment #6
pwolanin CreditAttribution: pwolanin commentedAh, ok - maybe I was expecting it all together in one patch.
Comment #7
GaëlGSorry, 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.
Comment #8
GaëlGMaybe 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_searchHowever, 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 ?
Comment #9
pwolanin CreditAttribution: pwolanin commentedI 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.
Comment #10
GaëlGThank you for your attention. What do you mean ? Which way to chose ? What is the problem with the hooks ?
Comment #11
jpmckinney CreditAttribution: jpmckinney commentedSplitting the module at this point makes for an awkward upgrade path, no?
Comment #12
jpmckinney CreditAttribution: jpmckinney commentedComment #13
GaëlGOK. And what do you think of #8 ?
Comment #14
jpmckinney CreditAttribution: jpmckinney commentedI was thinking about the checkbox option, not sure what pwolanin's concerns were with that route.
Comment #15
bchavez CreditAttribution: bchavez commentedHi 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
Comment #16
pwolanin CreditAttribution: pwolanin commentedThe search tab is provided by implementing a search module hook. In Drupal 6 there is no easy way to turn that tab off.
Comment #17
bchavez CreditAttribution: bchavez commentedWell, do you have any information to help me to correct this...???
Comment #18
bchavez CreditAttribution: bchavez commentedHi... if you use tab tammer module, you can delete, deactivate, hide any tab...
Comment #19
janusman CreditAttribution: janusman at Acquia commented