Closed (outdated)
Project:
Search API
Version:
7.x-1.x-dev
Component:
Framework
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Jun 2012 at 16:07 UTC
Updated:
14 Aug 2026 at 20:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
drunken monkeyThat would only be possible (unless I'm mistaken) if there already were some indexes before the module got activated. I guess this would be possible if you're using Features, but then the feature module should depend on the Search API, and thus be enabled afterwards.
Can you explain your detailed setup? (I know of people who're including Search API in their installation profiles, so this can't be broken per se.)
Comment #2
exratione commentedWe are using Features, very extensively. The breakage happened prior to creating any search_api specific featurized content, however. Essentially as soon as I added it to the profile, it exploded.
Our installation profile is nearing 300 modules. Explaining that in detail is somewhat outside the scope of a bug post. We are not doing anything particularly novel beyond using a lot of featurized settings.
We are using dev branch ctools, though that hasn't caused us any other major issues.
We are also patching module_enable() more or less as described in http://drupal.org/node/1311828#comment-5365170
That should also not have any effect here.
Ultimately the only thing that was feasible for us under the circumstances (time is at a premium...) was to remove the hook_enable() implementation entirely. That seems to work fine in conjunction with our setup - if I'm reading it right, site_api_enable() really isn't doing anything that would matter for a completely fresh install of a site.
We are now using featurized search indexes and sources and that works fine, so long as search_api_enable() is disabled.
So I might argue that site_api_enable() could look like this, so as not to fire during an install profile, and it probably wouldn't cause anyone any issues:
Comment #3
drunken monkeyI'm still not sure why this should break for you (maybe an older PHP version?), but if it helps I'd gladly make that change. I also couldn't think of any cases in which this might cause troubles – when installing Search API for the first time during the Drupal install, there shouldn't be any chance of indexes being already present.
Please test the attached patch (reviews of others, whether this really is save, would also be appreciated)!
Comment #4
exratione commentedWe're on PHP 5.3.5.
The patch looks fine, but you should of course solicit other opinions.
Comment #5
damien tournoud commentedYour problem is definitely the patch you applied for #1311828-27: Installation fails with SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database.media_type' doesn't exist. That patch is totally bogus: both
hook_install()andhook_enable()are meant to be run in a clean state, after the module list, registry and schema has been rebuilt.At the minimum it is a CTools bug: CTools should not trigger side effects in a
hook_registry_files_alter()that is itself *not* guaranteed to run in a clean state. That said, I never seen that being an issue in practice, so it might have been fixed in CTools along the way.Comment #6
exratione commentedFor context, the patch I referenced is a way to work around a fair number of ctools-dependent modules doing things that break install profiles. The ideal world solution is for the authors to fix their modules - but that isn't going to happen in time, and especially given that ctools is involved. No-one really cares about install profile functionality, sadly.
If this issue is caused by that patch - and I have my doubts - then it will be the first such issue we've seen. The patch we actually use in place of the earlier version referenced is attached as an FYI.
Comment #7
damien tournoud commentedWe have developed and are maintaining a fair number of installation profiles (including Commerce Kickstart) and I have to say we never bumped into the issue you mention.
Do not touch what you don't understand.
hook_install()andhook_enable()are designed to run in a clean state where code is loaded, API is available, database tables have been created, etc. Search API is not doing anything wrong here.Comment #8
JayKayAu commentedHi all,
I've just encountered this error while installing Commerce Kickstart:
So I gave "drush dl search_api" a shot, and it gave me this error:
Does that help anyone pinpoint the problem?
Comment #9
socialnicheguru commentedfor some reason, class files are not always loaded on install.
See this comment/issue for background
https://www.drupal.org/node/542202#comment-6065048
This patch is a different approach to the others.
This patch has worked for me.
Comment #10
drunken monkeyNo-one has complained about this in almost four years, so I'm pretty sure we're good as-is. (The comment also seems wrong – I just tried it out, to make sure, but as expected, autoloading also works when using static properties or methods. Also, I don't see the connection to this issue.)
Comment #11
guypaddock commentedI can confirm this is still an issue for us in 7.x-1.22 with the same repro steps. The patch provided does not work; we get this error:
Comment #12
guypaddock commentedI can confirm that downgrading from 7.x-1.22 to 7.x-1.20 seems to fix / work around the issue.
Comment #13
guypaddock commentedI take it back. I'm still seeing the issue sporadically in 7.x-1.20 as well.
Comment #14
drunken monkeyI know plenty of people who have this module in their install profile – there's even several popular distributions that include it.
Whatever is happening has to be very specific to your setup, and nothing that's generally broken.
If you can find a simple enough solution that works for you, I'd still consider committing it to be on the safe side, but I can't really help you debug.
Comment #15
benstallings commented