>Do you have "has status(:id), :as => :status_id" line in your index block?
(please note it's almost always useful to provide the index definition as
part of help requests)
I had :status_id in the index block.
Here's what my model looks like:
define_index do
indexes title, :sortable => true
indexes description
indexes location, :sortable => true
indexes contact_name
indexes condition, :sortable => true
indexes category(:name), :as => :category_name, :sortable => true
indexes sub_category(:name), :as => :sub_category_name
indexes fits.vehicle(:name), :as => :vehicle_name, :sortable => true
has_a status_id, updated_at
end
Here's an extract from config/development.sphinx.conf:
source part_core_0
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass = evolution
sql_db = realautoparts-development
sql_sock = /tmp/mysql.sock
sql_query_pre = SET NAMES utf8
sql_query = SELECT SQL_NO_CACHE `parts`.`id` * 2 + 1 AS `id` ,
CAST(`parts`.`title` AS CHAR) AS `title`, CAST(`parts`.`description` AS
CHAR) AS `description`, CAST(`parts`.`location` AS CHAR) AS `location`,
CAST(`parts`.`contact_name` AS CHAR) AS `contact_name`,
CAST(`parts`.`condition` AS CHAR) AS `condition`, CAST(`categories`.`name`
AS CHAR) AS `category_name`, CAST(`sub_categories`.`name` AS CHAR) AS
`sub_category_name`, CAST(GROUP_CONCAT(DISTINCT IFNULL(`vehicles`.`name`,
'0') SEPARATOR ' ') AS CHAR) AS `vehicle_name`, `parts`.`id` AS
`sphinx_internal_id`, 3913146360 AS `class_crc`, '3913146360' AS
`subclass_crcs`, 0 AS `sphinx_deleted`, IFNULL(`parts`.`title`, '') AS
`title_sort`, IFNULL(`parts`.`location`, '') AS `location_sort`,
IFNULL(`parts`.`condition`, '') AS `condition_sort`,
IFNULL(`categories`.`name`, '') AS `category_name_sort`,
GROUP_CONCAT(DISTINCT IFNULL(IFNULL(`vehicles`.`name`, ''), '0') SEPARATOR '
') AS `vehicle_name_sort` FROM `parts` LEFT OUTER JOIN `categories` ON
`categories`.id = `parts`.category_id LEFT OUTER JOIN `sub_categories` ON
`sub_categories`.id = `parts`.sub_category_id LEFT OUTER JOIN `fits` ON
fits.part_id = parts.id LEFT OUTER JOIN `vehicles` ON `vehicles`.id =
`fits`.vehicle_id WHERE `parts`.`id` >= $start AND `parts`.`id` <= $end
GROUP BY `parts`.`id` ORDER BY NULL
sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1) FROM
`parts`
sql_attr_uint = sphinx_internal_id
sql_attr_uint = class_crc
sql_attr_uint = sphinx_deleted
sql_attr_str2ordinal = title_sort
sql_attr_str2ordinal = location_sort
sql_attr_str2ordinal = condition_sort
sql_attr_str2ordinal = category_name_sort
sql_attr_str2ordinal = vehicle_name_sort
sql_attr_multi = uint subclass_crcs from field
sql_query_info = SELECT * FROM `parts` WHERE `id` = (($id - 1) / 2)
}
index part_core
{
source = part_core_0
path = /home/ct9a/rails-projects/myApp/db/sphinx/development/part_core
charset_type = utf-8
}
index part
{
type = distributed
local = part_core
}
> If so, try searching using the :with param only, via the console or the
>> search command-line program. You can also examine the Sphinx config
>> generated in config/development.sphinx.conf. If no joy please put the model
>> associations, index definition, and search code on a paste site (
>> gist.github.com or Pastie) and let us know.
>>
>> Regards,
>> Andrew
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Thinking Sphinx" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<thinking-sphinx%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/thinking-sphinx?hl=en.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en.