Hi all,
I'm having trouble with multi-value attributes ....
class Title
define_index do
indexes [name, subtitle], :as => :complete_title, :sortable => true
indexes [isbn, isbn10], :as => :isbn_ref
has categorizations.category.bic_code
end
end
The generated sql query is:
----sql_query = SELECT `titles`.`id` * 2 + 1 AS `id` , CAST(CONCAT_WS(' ', `titles`.`name`, `titles`.`subtitle`) AS CHAR) AS `complete_title`, CAST(CONCAT_WS(' ', `titles`.`isbn`, `titles`.`isbn10`) AS CHAR) AS `isbn_ref`, IFNULL(CONCAT_WS(' ', `titles`.`name`, `titles`.`subtitle`), '') AS `complete_title_sort`, GROUP_CONCAT(`categories`.`bic_code` SEPARATOR ' ') AS `bic_code`, `titles`.`id` AS `sphinx_internal_id`, 3942078319 AS `class_crc`, '3942078319' AS `subclass_crcs`, 0 AS `sphinx_deleted` FROM titles LEFT OUTER JOIN `categorizations` ON categorizations.title_id =
titles.id LEFT OUTER JOIN `categories` ON `categories`.id = `categorizations`.category_id WHERE `titles`.`id` >= $start AND `titles`.`id` <= $end GROUP BY `titles`.`id` ORDER BY NULL
sql_query_range = SELECT MIN(`id`), MAX(`id`) FROM `titles`
sql_query_info = SELECT * FROM `titles` WHERE `id` = (($id - 1) / 2)
sql_attr_str2ordinal = complete_title_sort
sql_attr_multi = uint bic_code from field
sql_attr_uint = sphinx_internal_id
sql_attr_uint = class_crc
sql_attr_multi = uint subclass_crcs from field
sql_attr_uint = sphinx_deleted
}
----
While indexing, note that Mvalues == 0:
---
indexing index 'author_core'...
collected 2228 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, 100.0% done
sorted 0.0 Mhits, 100.0% done
total 2228 docs, 29897 bytes
total 0.052 sec, 570183.46 bytes/sec, 42491.51 docs/sec
distributed index 'author' can not be directly indexed; skipping.
indexing index 'title_core'...
collected 2630 docs, 0.1 MB
collected 0 attr values
sorted 0.0 Mvalues, 100.0% done
sorted 0.0 Mhits, 100.0% done
total 2630 docs, 145473 bytes
total 0.050 sec, 2937780.18 bytes/sec, 53112.00 docs/sec
distributed index 'title' can not be directly indexed; skipping.
---
Title.search(:with => {:bic_code => 'F'}) returns nothing. (where a bic_code is = "F FG TR T")
The generated sql contains uint bic_code - perhaps that's my problem ? Does MVA support strings via str2ordinal ?
Thanks,
highandwild / Ahsan Ali