Search engine query failed



When I login to the KMC and hit the Content tab, I get a message “Search engine query failed”, after hitting OK and KMC’s Refresh link a random number of times the message dissapear and eventually loads my video list, but at some point it goes over again.

Sanity Check failed when creating partner (Partner creation failed. I will skip all tests that require it.)

As of

I run
/usr/bin/php /opt/kaltura/bin/create_partner.php $secret_key param @service_url

Return: new_partner_id

Following a piece of information I captured from each cycle. Any hints?

indent preformatted text by 4 spaces
2017-08-12 19:17:28 [0.000120] [] [1643084131] [70] [API] [KalturaPDO->exec] DEBUG: Sql took - 3.9100646972656E-5 seconds
2017-08-12 19:17:28 [0.000116] [] [1643084131] [71] [API] [kSphinxSearchManager->execSphinx] ERR: exception 'Exception' with message 'No database selected' in /opt/kaltura/app/infra/log/KalturaLog.php:83
Stack trace:
#0 /opt/kaltura/app/plugins/sphinx_search/lib/kSphinxSearchManager.php(446): KalturaLog::err('No database sel...')
2017-08-12 19:17:59 [0.000119] [] [1224585153] [73] [API] [KalturaPDO->queryAndFetchAll] DEBUG: Sql took - 4.1007995605469E-5 seconds
2017-08-12 19:17:59 [0.000225] [] [1224585153] [74] [API] [kCoreException->__construct] ERR: exception 'kCoreException' with message 'Invalid sphinx query [SELECT str_entry_id  FROM kaltura_entry WHERE partner_id = 100 AND moderation_status not in(1,3) AND media_type in(1,2,5,6,201) AND type in(1,2,7) AND entry_status in(-2,-1,0,1,2,4,7) AND display_in_search <> -1 AND MATCH('( @sphinx_match_optimizations P100ST-1 | P100ST-2 | P100ST0 | P100ST1 | P100ST2 | P100ST7 | P100ST4)') ORDER BY created_at DESC LIMIT 50 OPTION ranker=none, max_matches=50, comment='@KALTURA_COMMENT@']
SQLSTATE error code [3D000]
Driver error message [No database selected]' in /opt/kaltura/app/plugins/sphinx_search/lib/SphinxCriteria.php:173
Stack trace:
#0 /opt/kaltura/app/plugins/sphinx_search/lib/SphinxCriteria.php(594): 
SphinxCriteria->executeSphinx('kaltura_entry', 'WHERE partner_i...', 'ORDER BY create...', 50, 50, true, '')
indent preformatted text by 4 spaces



Hi @riclaso,

Something is wrong with your Sphinx server.
Is it running?
You can check that with:
# /etc/init.d/kaltura-sphinx status
if it’s not running, start it:
# /etc/init.d/kaltura-sphinx start

Then ensure you can connect to it with:
# mysql -h127.0.0.1 -P9312
if this is a cluster, make sure all front and batch nodes are able to connect to it with whatever hostname[s] you configured in /opt/kaltura/app/configurations/db.ini:

sphinx1.adapter = mysql
sphinx1.connection.dsn = "mysql:host=sphinx_host;port=9312;"

sphinx2.adapter = mysql
sphinx2.connection.dsn = "mysql:host=sphinx_host1;port=9312;"

If you made adjustments to /opt/kaltura/app/configurations/db.ini be sure to reload your Apache afterwards.

Once all this is verified, I also suggest you reindex Sphinx with:


thanks @jess
The problem was here

My db.ini looked like this
sphinx2.connection.dsn = "mysql:host=;port=9312;"
changed host= and the error disappeared
Thanks a lot!


Just to confirm, during the setup I think I should left the server2 empty; my .ans files has:
For future installation, shall I then use


Hi @riclaso,

Indeed, both SPHINX_SERVER1 and SPHINX_SERVER2 should be set to a hostname/IP that is accessible. In an all in one instance, they should both be set to
You must have a very old answer file since this commit ensures that if you do not input a second Sphinx host, shall be used:


Thanks @jess,
I can definitely see the logic in that push, but just in case, I installed the KCE around three months ago