On 14/01/2013, at 11:37 PM, [email protected] wrote:
> and I also have a problem with the following index declarations:
>
> has "CRC32(file_chromaticity)", :as => :chromaticity, :type => :integer
>
> The error I get is:
> Generating index files for image_core
> rake aborted!
> undefined method `__name' for "CRC32(file_chromaticity)":String
> -e:1:in `<main>'
> Tasks: TOP => ts:generate
> (See full trace by running task with --trace)
Firstly - you're using a SQL snippet, and real-time indices don't touch the
database - in this situation, Thinking Sphinx communicates directly between
your Rails models and Sphinx. Also, there's no support in Thinking Sphinx v3
for CRC32 encoding… mind you, you could add it itself.
Perhaps something like this within the model (and add a "require 'zlib'" at the
top of your model):
def file_chromaticity_to_crc32
Zlib.crc32 file_chromaticity
end
And then in your index definition, you can reference that method:
has file_chromaticity_to_crc32, :as => :chromaticity, :type => :integer
> and the line
>
> indexes assoc(:file)
>
> produces the following error:
> Generating index files for image_core
> rake aborted!
> undefined method `assoc' for #<Image:0x007f979ffccb30>
> -e:1:in `<main>'
> Tasks: TOP => ts:generate
> (See full trace by running task with --trace)
You don't need this line - because you're dealing with Ruby, not SQL, there's
no need to specify joins.
Cheers
--
Pat
--
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.