Jump to:
| Project: | Multisite Search |
| Version: | 6.x-1.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Ok, now that the 6.2 bug is fixed with v1.1, here's a new problem:
When I enable the module and go to the config page, I get this error (I replaced the actual database and domain names with generic values here):
• user warning: Table 'database.multisite_drupal_search_sites' doesn't exist query: SELECT * FROM multisite_drupal_search_sites ORDER BY site_id in /var/www/vhosts/domain.org/httpdocs/sites/all/modules/multisite_search/multisite_search.module on line 92.
• user warning: Table 'database.multisite_drupal_search_sites' doesn't exist query: SELECT COUNT(*) FROM multisite_drupal_search_sites ORDER BY site_id in /var/www/vhosts/domain.org/httpdocs/sites/all/modules/multisite_search/multisite_search.module on line 93.
If I ignore it and try to add a sub-site, I get:
• user warning: Table 'database.multisite_drupal_search_sites' doesn't exist query: SELECT * FROM multisite_drupal_search_sites ORDER BY site_id in /var/www/vhosts/domain.org/httpdocs/sites/all/modules/multisite_search/multisite_search.module on line 92.
• user warning: Table 'database.multisite_drupal_search_sites' doesn't exist query: SELECT COUNT(*) FROM multisite_drupal_search_sites ORDER BY site_id in /var/www/vhosts/domain.org/httpdocs/sites/all/modules/multisite_search/multisite_search.module on line 93.
• user warning: Table 'database.multisite_drupal_search_sites' doesn't exist query: INSERT INTO multisite_drupal_search_sites VALUES(NULL, 'prefix_', 'http://domain2.com') in /var/www/vhosts/domain.org/httpdocs/sites/all/modules/multisite_search/multisite_search.module on line 138.
• user warning: Table 'database.multisite_drupal_search_sites' doesn't exist query: SELECT * FROM multisite_drupal_search_sites ORDER BY site_id in /var/www/vhosts/domain.org/httpdocs/sites/all/modules/multisite_search/multisite_search.module on line 92.
• user warning: Table 'database.multisite_drupal_search_sites' doesn't exist query: SELECT COUNT(*) FROM multisite_drupal_search_sites ORDER BY site_id in /var/www/vhosts/domain.org/httpdocs/sites/all/modules/multisite_search/multisite_search.module on line 93.
Comments
#1
I found this same error when enabling the Multisite Search module. It turns out that because of my main install having a prefix for all tables this is appearing. If I changed the .module file and added in my prefix to the lines above (and a few others) it would work.
But then when you attempt to search through the other domains, the url rewrite will redirect pages to ones from the main content, but use the sub-domain path.
For example the search should take you to:
sub-domain.com/content/about
but instead takes you to:
sub-domain.com/people/person-1
where the people/person-1 is a url rewrite on the main install and not even used in the sub-domain. This other url will also change, but the node numbers are not even identical between the two tables.
I have to disable this module as I cannot have the bogus page links popping up. I did the cron jobs on all sub-domains (including the main install) before even attempting to use the search features. If anyone can come up with a fix that would be great.
#2
I have a 4 site install with each on a different domain (not sub-domains). Each has its own database table prefix so, modifying the .module file would not work. The problem, as I see it, is that the module fails to inherit the table prefix from Drupal properly for the site it is installed on.
In fact, it installs the required database tables properly on a per site prefix basis (I have them as site1_multisite_drupal_search_sites and site2_multisite_drupal_search_sites, etc) but it fails to then address them in the same way.
#3
Ha! Solved! (didn't think I'd figure it out that fast)
Basically, all of the query statements in the .module file need the table enclosed in {}.
So replace all 7 occurrences of multisite_drupal_search_sites with {multisite_drupal_search_sites}
4 occurrences of multisite_drupal_search_dataset with {multisite_drupal_search_dataset}
4 occurrences of multisite_drupal_search_total with {multisite_drupal_search_total}
2 occurrences of multisite_drupal_search_total with {multisite_drupal_search_total}
#4
Doh! One other error on line 419 of the .module file:
The statement INNER JOIN ".$tbl_prefix."users u ON u.uid = n.uid in the middle of that query fails on my multisite install because the user table is shared between the sites instead of being unique to each.
My settings file defines these as such:
$db_prefix = array('default' => 'sitename_',
'users' => 'shared_',
'sessions' => 'shared_',
'role' => 'shared_',
'authmap' => 'shared_',
'sequences' => 'shared_',
'profile_fields' => 'shared_',
'profile_values' => 'shared_',
'users_roles' => 'shared_',
);
My quick fix was to change the .module file to match my setup:
INNER JOIN shared_users u ON u.uid = n.uid
#5
I didn't get any of this error. Can anybody tell how exactly to reproduce such error?
#6
I'm getting this errors but with version 5.x-1.0.
I guess you can reproduce the errors when having a multisite installation, with two or more sites sharing the tables:
'default' => 'sitename_','users' => 'shared_',
'sessions' => 'shared_',
'role' => 'shared_',
'authmap' => 'shared_',
'sequences' => 'shared_',
'profile_fields' => 'shared_',
'profile_values' => 'shared_',
'users_roles' => 'shared_',
I think #4 is the key to reproduce this error:
#4:
The statement INNER JOIN ".$tbl_prefix."users u ON u.uid = n.uid in the middle of that query fails on my multisite install because the user table is shared between the sites instead of being unique to each.
Also, the #4 solution did work partially for me solving the error of not finding the table mymainsite_users, but then when searching something outside the current site, I would get the results, but the url would be wrong..
The #3 didn't work for me because it generated more errors, mostly the prefix duplicated on the query... if my table prefix is 'mysubsite_' then I would get:
table mysubsite_mysubsite_multisite_drupal_search_total doesn't exist.....again, I'm running 5.x just didn't wanted to change the version..
#7
To clarify, since there might be some confusion, my post #3 is for the 6.x-1.1 version only. I don't use Drupal 5 and can't speak to its syntax differences.
Post #4 is a (admittedly poor) fix for using this module in a multisite configuration where the users data is shared between the sites. The default for this module is to have multiple sites sharing a database, but not data. So, if you config your sites' table prefixes as I describe, then making that change to line 419 is for you. If you don't use a shared users config, then don't make that change.
I still have it set up for my sites and it still works with my changes under Drupal 6.9.
I honestly haven't looked at this module in a long time. However, since there have been no updates since last June, it is possible this module has been abandoned by the maintainer. When I posted this report last year, I was still pretty new to Drupal module coding. I'm still no expert, but in quickly looking over the module code, I can see where things could be streamlined and improved. I have no personal need to do this right now, but maybe later on (if there's some free time) I might be able to take a whack at it.
#8
The coding cleanup has been implemented in this version of the module (see attachment on this comment). It still only works with table prefixing though.
Once I figure out CVS, I'll look to commit these changes to a new branch. It's a shame the submitted code doesn't work right upon download, but I'm working on it.
If anyone would like to help review code that would be great too!
#9
Brackets have been added to the database tables in the latest -dev version.
As to #4, discussion of this problem has been moved to #816948: return correct site's user data on search results page.
#10
Automatically closed -- issue fixed for 2 weeks with no activity.