try search = C.search 'test'
C == Class that implements thinking sphinx

finally:

search.each do |s|
s.post_desc
end

2010/8/2 Mike Disuza <li...@ruby-forum.com>

> Hi,
> I am implementing the "sphinx" search using "Thinking Sphinx" search.
> I have done everything configured.
> I have added the index fields in my model like this
> "
>  define_index do
>    indexes :name,:sortable => true
>    indexes description
>    has created_at, updated_at
>  end
> "
> My sphinx configuration file is as
> "
> source post_core_0
> {
>  type = mysql
>  sql_host = localhost
>  sql_user = root
>  sql_pass =
>  sql_db = development
>  sql_sock = /var/lib/mysql/mysql.sock
>  sql_query_pre = SET NAMES utf8
>  sql_query_pre = SET TIME_ZONE = '+0:00'
>  sql_query = SELECT SQL_NO_CACHE `posts`.`id` * 1 + 0 AS `id` ,
> `posts`.`name` AS `name`, `posts`.`description` AS `description`,
> `posts`.`id` AS `sphinx_internal_id`, 1921285768 AS `class_crc`, 0 AS
> `sphinx_deleted`, IFNULL(`posts`.`name`, '') AS `name_sort`,
> UNIX_TIMESTAMP(`posts`.`created_at`) AS `created_at`,
> UNIX_TIMESTAMP(`posts`.`updated_at`) AS `updated_at` FROM `posts`
> WHERE `posts`.`id` >= $start AND `posts`.`id` <= $end AND deleted = 0
> GROUP BY `posts`.`id`  ORDER BY NULL
>  sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1)
> FROM `posts`
>  sql_attr_uint = sphinx_internal_id
>  sql_attr_uint = class_crc
>  sql_attr_timestamp = created_at
>  sql_attr_timestamp = updated_at
>  sql_attr_str2ordinal = name_sort
>  sql_query_info = SELECT * FROM `posts` WHERE `id` = (($id - 0) / 1)
> }"
>
> The searching works well but I am seeing in the log that it is firing a
> queri like " SELECT * FROM `posts` WHERE `id` = (1,2)"
>
> Is my configuration right?
>
> Also, if I am doing indexing like " indexes description, :as=>
> :post_desc" and if I try to access it like this:-
> "search=ThinkingSphinx.search "test"
> puts search.post_desc
> "
> Giving me an error that "post_desc" is undefined.
>
> Can anyone tell me wwhat is happening?
>
> Thanks,
> Mike
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com<rubyonrails-talk%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 
att: Luciano Sousa
http://www.lucianosousa.net
*Ruby on Rails Developer
*Linux User #456387
*Contato: (21) 7639-5049

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to