I am trying this module out and I want to make sure I'm understanding how to use it. I have an already existing site that does not have table prefixes. We will be adding subsites using Multisite feature and I can use prefixes at the time of install of the subsites.
Can I still use this module if the main install site is not prefixed?
I'm trying to follow the directions and get the multisite search to work on a sandbox of the existing site but I'm not having any success.
I've tried adding the databases to the multisite configuration with the databasename and the period at the end, but I think I'm not doing something right. Or, maybe it's just that you have to have prefixed tables for this to work.
Any assistance/feedback is greatly appreciated.
Thanks,
Dan Serrato
Comments
Comment #1
earthday47Hi daniel-san -
Although I've never tried it, I think it should work. Could you try doing the following and let me know the results?
Enter the main site and leave the prefix blank.
Enter the sub site with table prefix.
If that doesn't work, perhaps try this:
Enter the main site with ' ' (space character) as the table prefix.
Enter the subsite with the table_prefix_ .
Solution #2 should turn the queries into something like "SELECT * from table_name" (with a double space), which as far as I know, should be valid MySQL.
Let me know.
Comment #2
daniel-san commentedHey earthday47,
Thanks for the response. Here's what I've got at this point
You can't leave the prefix field blank since it's a required field. All three fields on that configuration page are required.
I added the main site with ' ' in the prefix field and then main site URL and name
I added the subsite that has tables prefixed with the prefix and an underscore (prefixname_) and then URL and name
**I removed my error text that was previously here**
may update later
Dan
Comment #3
daniel-san commentedGetting a better understanding of the module now.
Set up a brand new testsite and prefixed the initial database with "site1_"
Set up a subsite, used the original database from site 1 and prefixed the new install with "site2_"
After setting up multisite configuration on site 1 to include both Site 1 and Site 2.
Added content on both sites.
Ran cron on Site 2.
Ran cron on Site 1.
Search of all sites brought up content from both Site 1 and Site 2.
But, after adding another story to Site 2 and running cron on both sites, the new story does not show up in the All Sites search. Interesting.
Getting closer to being able to understanding how to use the module. But, still don't know if I'll be able to make it work on a site that already has an install and is not prefixed.
Thanks for the help.
D
Comment #4
earthday47Thanks, I'm filing it as a bug report. I think I can tweak the queries to account for this. Just gotta learn Git...
Comment #5
daniel-san commentedDid some testing on this the other night and got it to work. The key was the Multisite Cron Configuration on Site 1. I set Cron TTL to 0 and now it will gather content from site 2 on cron. Of course, this is only when cron has been run on Site 2 after the new content has been added.
I would appreciate a little help on understanding what Cron TTL is, as well as NNN in the instructions under the text box on that page. These acronyms are new to me and might be to others who are being introduced to using this scenario through the module.
It was a pretty great feeling being able to search across sites after getting this working. I'm curious to see if we can make it work over multiple databases still. Thanks so much for the work you have done.
Comment #6
earthday47Hmm...
I started to make a patch that added the keyword "<none>", but then I realized that ONLY makes sense if all the sites are in the same database.
daniel-san: If you follow the steps below, you can get the multisite setup to work with prefixed and non-prefixed database tables. I've confirmed it with some testing.
Use case: 3 drupal sites:
All are in database drupal, but db2 and db3 are prefixed:
Multisite prefixes should be configured like so:
Although I would highly recommend putting the test Drupal installation tables in a separate database, because down the road you could have further complications.
To be absolutely safe, you could, in fact, do this:
Let me know if this works for you.
I opened an issue #1092838: Improve documentation and UI to address some of the UI badness you mentioned. I didn't author that text, so I don't feel bad. :)
Comment #7
daniel-san commentedAwesome.
I am going to have to try this out next week because of my schedule, but I will give it a shot and give feedback.
Thanks.
Dan
**UPDATE**
Just tried out the above recommendation and it did work.
I have a non-prefixed database on the original site (let's call it ORIGINALSITE)
I have a prefixed database for the testsite that is a subsite to the original (let's call it TESTSITE).
NOTE: when I created this site, I did not prefix using an underscore.
In the settings for Multisite Search:
- added the original site with "ORIGINAL."
- added the subsite with table prefix "TESTSITE"
Added new content to TESTSITE and ran cron on both sites. Searching for certain content from search block on ORIGINALSITE brought up the content from TESTSITE.
Success.
Comment #8
ranoble commentedDevelopment of our Drupal site followed a path that perhaps others have, too. We started with prefixed multisites in one database. The main site used no prefix. Performance was unacceptably slow. Among the things we did to address this was break out each site into its own database. In the process of doing so, we did NOT remove the table prefixes. Now we have multiple databases AND table prefixes.
As a slight extension of Comment #6, our multisite_search_sites table for multiple databases and table prefixes looks like:
Comment #9
daniel-san commentedWe have not run our multisite search on our production site and only tested on an example site to prove that we could make it work. This is good to know regarding performance.
I have a question regarding your setup above. You've outlined the setup nicely, but can you explain the actual setting up of the databases and install just a bit more. Specifically, when you setup the initial site are you prefixing that database with your example of db1 or is that just the name of the database? When the subsites are setup, do you prefix them at setup with db2.prefix2_ or just prefix2_?
By looking at your example, I am figuring that the setup goes something like this:
Setup first database and it is named db1. Then install Drupal site and do not prefix.
Setup second database and it is named db2. Install second Drupal site use new db2 database and prefix with prefix2_
Setup third database and it is named db3. Install third Drupal site and use db3 database and prefix with prefix3_
After all is setup, go into Multisite Search setup and use the above example to get the module to search the proper tables.
Am I understanding your explanation correctly?
Comment #10
earthday47In the newest release, 6.x-2.1, I revised the README.txt file to include links to Multisite resources, as well as recommending including the database name along with the table name.
Good?
Comment #11
earthday47The new 6.x-2.3 version and 7.x-1.0 version solve this issue by requiring database name and making the table prefix optional.