RSS

Ultrasphinx bug?

1 Comment | This entry was posted on Jun 15 2008

It seens Ultrasphinx plugin for Ruby on Rails doesn’t know how to deal with Decimal data type from MySQL.

You can use a Decimal column for indexing, but when you need to make thecolumn sortable it comes the problem. As you know, faceting is on for numeric and date fields and to add the sortable feature to it, we need to pass a hash with

{:sortable => true}

Ok, then you run rake tasks to rebuild your configuration file and indexes and try to sort the search by the Decimal column and we got an error saying our column isn’t sortable.

You can check isn’t generating the _sortable sufix by looking the ultrasphinx configuration file. All other sortable fields have their _sortable sufix added to ti, except by the decimal field.

I’ll report it as soon as possible to Evan Weaver, the plugin’s owner, or maybe try to fix it by myself.

Updated: June, 16

I fixed by adding  ‘decimal’ => ‘float’ in the TYPE_MAP inside the fields.rb file of ultrasphinx plugin.