thinking sphinx unknown type 'mysql'; skipping
Asked Answered
J

4

19

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:

development:
 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.

Jerilynjeritah answered 4/7, 2011 at 12:5 Comment(0)
C
14

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
Cronyism answered 4/7, 2011 at 16:9 Comment(4)
I shall try this later.. ThanksJerilynjeritah
Hi, this is running on rails3 - is it not enough to install the gem and include in the gem file?Jerilynjeritah
No, Thinking Sphinx is an interface to Sphinx Search for Ruby, you need to install Sphinx on your system.Cronyism
Ok, this is the bit I was missing... I hadn't realised I needed sphinx too. Installed and have another error but can sort that one. JJerilynjeritah
N
64

As per the link here, you could simply do the following on homebrew (mac):

brew install sphinx --with-mysql

That worked for me :)

Navicular answered 8/1, 2013 at 13:8 Comment(3)
you can always brew options [package name] which will give u all available flag. in this case --mysql or --postgresStar
Had to brew reinstall sphinx --mysql since sphinx search was already installed.Studley
the --mysql switch is deprecated. Use --with-mysql now.Fluorspar
C
14

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
Cronyism answered 4/7, 2011 at 16:9 Comment(4)
I shall try this later.. ThanksJerilynjeritah
Hi, this is running on rails3 - is it not enough to install the gem and include in the gem file?Jerilynjeritah
No, Thinking Sphinx is an interface to Sphinx Search for Ruby, you need to install Sphinx on your system.Cronyism
Ok, this is the bit I was missing... I hadn't realised I needed sphinx too. Installed and have another error but can sort that one. JJerilynjeritah
J
3

Also when installing on OSX via homebrew try this:

sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
brew install --interactive sphinx
./configure
make
make install
exit
Jehial answered 7/1, 2013 at 23:40 Comment(0)
M
2

The generated source looks correct - is it possible your version of Sphinx was compiled without MySQL support?

Myranda answered 4/7, 2011 at 12:48 Comment(1)
Hi Pat, I just installed the gem and can see in mysql listed. Perhaps I could try installing as a plugin but was sort of trying to avoid. It's quite frustrating now...Jerilynjeritah

© 2022 - 2024 — McMap. All rights reserved.