Shared search

Events happening in the community are now at Drupal community events on www.drupal.org.
timmillwood's picture

I have a few Drupal sites running from one code base and one database. The tables currently shared are Authmap, profile_fields, profile_values, role, sessions, users and users_roles.

I want the search to search all of the sites, can this be done by just sharing the search tables or is it more complex.

Tim

Comments

As all the indexed

beautifulmind's picture

As all the indexed information is stored in the search table, I think you can search content on multiple sites at once.

:)
beautifulmind

SID / Type won't be unique

austinone's picture

If you're not sharing your node table (or trying to compensate some other way) you are going to have a problem. The search_index table is uses sid / type as the primary index. For your node indexing, this table will be filled with type "node" and your node ids. Without unique node ids, you are going to have an issue with conflicts. On top of that, your search results won't really know which site to point to.

This is one of the big unsolved problems that I have had with trying to use multi-site with semi-related sites. I don't know if there is an easy answer. This is one of the things that got me to thinking about sharing more tables between sites and mitigating access using Drupal's internal access apis. http://groups.drupal.org/node/12975 But I would love it if an existing answer existed.

well I guess I will have to

timmillwood's picture

well I guess I will have to tell them it can't be done!

Hey why don't you try

beautifulmind's picture

Hey why don't you try http://drupal.org/project/domain?

It'll solve all your problems.

:)
beautifulmind

Not so fast!

boris mann's picture

It's a bit of a workaround, but you can use OpenSearch and the OpenSearch Aggregator (http://drupal.org/project/opensearch_aggregator) to accomplish this. The maintainership just changed hands and is in the process of being updated.

Not impossible

austinone's picture

Sorry I didn't mean to say a unified search was impossible but it is going to take more work than just sharing the search table.

I like Boris's suggestion of opensearch. That might be your best option - of course I admit I don't understand domain as well as I should.

A hackish thing to do might just be to have varying ranges of node ids on each site. So depending on expected sizes of your sites one might have a starting node I'd of 100000 and the other at 200000. Then you could possibly share your search index tables. You would have to make sure in the search results that the result linked to the correct site which maybe you could hack in to the search results theme.

There is no simple solution, but..

Etanol's picture

I have a similar problem but on a slightly larger scale (350 drupal sites at the moment) and I will be going with automatic periodical agregation of all nodes into a separate database (with additional key - site identificator). To improve performance the database will be write optimized. After agregation it will be replicated do a separate read only one. Indexing and search will be done with sphinx search.

Multisite

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: