Jenny Blunt Jenny Blunt - 3 months ago 9
Ruby Question

thinking sphinx unknown type 'mysql'; skipping

I'm using ts version 2.0.5, rails 3.0.9 and mysql2 0.2.11

When trying to create my indexes, using rake ts:index, I get the following error:

ERROR: source 'technical_core_0': unknown type 'mysql'; skipping.

My development.sphinx.conf contains:

source technical_core_0
type = mysql
sql_host = localhost
sql_user = root
sql_pass =
sql_db = ps_development
sql_sock = /tmp/mysql.sock
sql_query_pre = SET NAMES utf8
sql_query_pre = SET TIME_ZONE = '+0:00'
sql_query = SELECT SQL_NO_CACHE `technicals`.`id` * CAST(1 AS SIGNED) + 0 AS `id` , `orders`.`name` AS `author`, `technicals`.`id` AS `sphinx_internal_id`, 0 AS `sphinx_deleted`, 488243725 AS `class_crc`, IFNULL(`orders`.`name`, '') AS `author_sort`, `technicals`.`order_id` AS `order_id`, UNIX_TIMESTAMP(`technicals`.`created_at`) AS `created_at`, UNIX_TIMESTAMP(`technicals`.`updated_at`) AS `updated_at` FROM `technicals` LEFT OUTER JOIN `orders` ON `orders`.`id` = `technicals`.`order_id` WHERE (`technicals`.`id` >= $start AND `technicals`.`id` <= $end) GROUP BY `technicals`.`id`, , `orders`.`name`, `technicals`.`id`, `orders`.`name`, `technicals`.`order_id`, `technicals`.`created_at`, `technicals`.`updated_at` ORDER BY NULL
sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1) FROM `technicals`
sql_attr_uint = sphinx_internal_id
sql_attr_uint = sphinx_deleted
sql_attr_uint = class_crc
sql_attr_uint = order_id
sql_attr_timestamp = created_at
sql_attr_timestamp = updated_at
sql_attr_str2ordinal = author_sort
sql_query_info = SELECT * FROM `technicals` WHERE `id` = (($id - 0) / 1)

Which is a bit odd as my database.yml file contains mysql2 and a root password.

Can you help me get past this stage? I tried also creating a sphinx.yml file with:

adapter: mysql2

But this also fails.

-- UPDATE --

I added this into the development initialisers file:

ThinkingSphinx.database_adapter = :mysql2

Which gives error about only MySQL being supported.


When you are compiling Sphinx you should specify the --with-mysql flag.

$ ./configure --with-mysql
$ make
$ sudo make install

You might need to specify the location of your MySQL library's include files. For example on a fresh installation of OS X:

$ ./configure --with-mysql=/opt/local/include/mysql5