Closed (fixed)
Project:
Search API
Version:
7.x-1.x-dev
Component:
Framework
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Jan 2013 at 12:38 UTC
Updated:
27 Mar 2018 at 20:07 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #0.0
kenorb commentedremoved syntax error
Comment #0.1
kenorb commentedadded >
Comment #1
kenorb commentedDisabling Search API, clearing the cache and enabling it, do some workaround.
Comment #2
kenorb commentedInstead of throwing the fatal error, there should be some watchdog error.
I've this problem on clean installation of Drupal (site-install), only because the module which has the right solr server configuration is not enabled before search_api which cause the problems.
Comment #3
kenorb commentedAgain:
This time is caused, because Feature has index exported before the server in .info file.
The Feature order was:
Comment #3.0
kenorb commentedimproved wording
Comment #4
kenorb commentedRelated:
http://drupal.stackexchange.com/questions/77426/searchapiexception-unkno...
Comment #5
drunken monkeyDoes this still happen with the latest module version? Error reporting has been improved a lot since then.
If this is fixed, please mark it as such in the "Status" field.
Comment #6
kenorb commentedTested with the recent dev version, it is still happening.
It's happening especially when search_api_index are exported in different feature than the search_api_server.
Example:
There are 3 modules: ads_search, ads_search_db and ads_search_solr,
where ads_search_solr contains Solr related features, ads_search_db contains Db related features and ads_search has some common features for both.
When enabling one of the modules ads_search_solr or ads_search_db, or in any other combinations, it's throwing the errors.
Project URL: http://drupal.org/project/ads_features
Project Homepage: http://drupal.org/project/ads
Modules: https://github.com/mycognitive/ads_features
Feature info files:
https://github.com/mycognitive/ads_features/blob/master/ads_search/ads_s...
https://github.com/mycognitive/ads_features/blob/master/ads_search_solr/...
https://github.com/mycognitive/ads_features/blob/master/ads_search_db/ad...
For the workaround, some of the tricky code was introduced and it's still not perfect:
https://github.com/mycognitive/ads_features/commit/c1ca1d6172fa3d7f9c9bd...
https://github.com/mycognitive/ads_features/commit/9fbd2a464158831fb8938...
Comment #7
kenorb commentedThe error is quite different now, which says:
So the following order should work when enabling search_api_db:
1. Enabling ads_search which is dependend of search_api_db which will import search_api_index for server ads_search_server (which was not created yet).
2. At this stage search_api_db module should load search_api_db_service class.
3. ads_search_db imports ads_search_server, but with the exception:
"Search server with machine name ads_search_server specifies illegal service class search_api_db_service"
search_api_db module is already enabled when ads_search_db is being enabled, so there should not be any exceptions.
ads_search_db.info dependencies:
Hope that make sense.
Comment #8
drunken monkeyI really don't know how this could happen. We especially have code to prevent exactly this situation:
Maybe try to get a timeline of when this hook is called in relation to the other hooks, and how
search_api_get_service_info()behaves.Comment #9
joseph.olstadI solved this problem in my local environment (search_api_db , search_api , search_api_solr version 1.4) by simply deleting the row in the tables that contained the problematic search server entry.
in my case I am using a database search not a solr search and in my case I got the error
SearchApiException: Unknown server solr_server specified for index job_search. in SearchApiIndex->server() (line 377 of modules/search_api/includes/index_entity.inc).so I of course made a backup of the database first and then tested this (it worked for me):
delete from search_api_index where id = 2; #where 2 is the id of the search_api_index record that is causing the problem, you'll have to find out what id is problematic by looking at the rows in this table the machine name should correspond to the unknown server you're wanting to remove.
you might also need to delete a row in the search_api_server table if it is related to the search_api_index record you are having problems with.
after this I was able to reindex and index the content.
warning: please backup your database and try this on a copy of your site in a qa or dev environment.
Comment #10
giorgio79 commentedThis happened to me as well but with the Solr service. For some reason search_api_solr_service became disabled. Had to reenable it :)
Comment #11
roam2345 commentedThis ticket should be marked as works as expected.
The case where this happens is when one of the search_api modules is not activated in Drupal.
Something these features seem to have a knack of doing. (in my case was search_api_solr)
Comment #12
andyf commentedHi,
I think I might have experienced the same problem. I'm working on moving a site onto Acquia Cloud, and at the moment when I enable the search_api_acquia module for the new server I get:
Tracing through, it appears that the static cache in
search_api_get_service_info()isn't being cleared appropriately when a new module's enabled. I was surprised that this wouldn't be more widely reported so tried to create a minimal repro and found that you must have at least one search service enabled already for the problem to show. This seems to be because only in that case doessearch_api_system_info_alter()populate thesearch_api_get_service_info()static cache.It looks like the fix is basically in place in search_api.module:
But if you look at the stack trace above it's
entity_modules_enabled()which triggers the server being saved, so as far as I can tell the Search API hook needs to run before Entity API's. I'm still a bit surprised this hasn't affected more people, so I wonder if I might be missing something (:Anyway, I've attached a patch which should demonstrate the problem.
Thanks!
Comment #14
andyf commentedAnd this one seems to fix things for me, thanks.
Comment #16
andyf commentedOops, short array syntax crept in. Let's try again.
Comment #17
andyf commentedComment #19
joseph.olstad@AndyF backwards compatibility with php 5.3
module_enable(array('search_api_test2'));Instead of
module_enable(['search_api_test2']Please also review the rest of the patch for similar array() vs []
Patch needs reroll with recommended changes
Otherwise php 5.4 or higher only
Comment #20
andyf commented@joseph.olstad Thanks for your feedback - I made those changes in my last comment. I'm a little confused by the latest testbot output and would welcome help interpreting it!
Comment #21
andyf commentedNot sure what to make of the failure:
Doesn't seem to be connected with the patch...!
I've attached the full patch without the short array syntax, not sure what testbot will think...
Comment #23
joseph.olstad*edit* checked ctools, it passes 5.3 tests
Maybe something missed by ctools tests though.
Meanwhile I queued up php7 test
I recommend the search_api maintainer set the default test to php7
Comment #24
joseph.olstad#2942581: ctools.test breaks Feeds tests on PHP 5.3 because of short array syntax
Above issue fixed in ctools dev branch. But not yet released in a tagged release
Comment #25
andyf commentedThanks for looking into it @joseph.olstad! I've just run the tests locally on 5.3 and they passed, so I'm going to mark it as needs review again.
Comment #26
joseph.olstadPasses php 7 tests and I just triggered 5.4
Comment #28
drunken monkeyWow, thanks a lot for all your work there, AndyF! Great job finding out the root cause of this, writing a patch and even providing a proper test – makes it easy to see that there's indeed a problem, and the patch fixes it.
Patch looks great, too, nothing to complain about there either.
So: committed.
Thanks again!
Also, thanks a lot to joseph.olstad for the detective work regarding the mysterious test failure!
Comment #29
andyf commentedGreat, thanks!!
Comment #31
joseph.olstad@drunken_monkey, please tag and release search_api 7.x-1.23
lots of good quality commits since 7.x-1.22