Problems with Associations

11 görüntüleme
İlk okunmamış mesaja atla

benoror

okunmadı,
30 Tem 2010 22:21:0230.07.2010
alıcı Thinking Sphinx
Hi, I have many sphinx_scopes in my application's models, but one of
them doesn't work, I think it's because the odd way Sphinx store the
associated value.

As an example I will show some key pieces of my Product class model,
product.rb:


...
belongs_to :partner
# And partner belongs to city
...
define_index do
...
has partner.city(:state_name), :as => :state, :type => :string
...
end
...
sphinx_scope(:by_state) { | state_name | {
:with => { :state => state_name }
} }


Then I try in console:

Product.by_city('whatever_i_put_here_throws_same_resultset')

I guess sphinx is not storing the string properly, any ideas? Thanks a
lot!

Pat Allan

okunmadı,
30 Tem 2010 23:54:1630.07.2010
alıcı thinkin...@googlegroups.com
You're right about Sphinx not storing the string properly - 0.9.9 and earlier don't have a true concept of string attributes. 1.10-beta does, but Thinking Sphinx doesn't yet support that (I'm working on it).

In the meantime, it's worth reading this:
http://freelancing-god.github.com/ts/en/common_issues.html#string_filters

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 thinkin...@googlegroups.com.
> To unsubscribe from this group, send email to thinking-sphi...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
>

benoror

okunmadı,
31 Tem 2010 17:48:1931.07.2010
alıcı Thinking Sphinx
Thanks Pat, I understand now the string problem. But how can I apply
the CRC32 solution to the associated value ?

Thanks again!

On Jul 30, 10:54 pm, Pat Allan <p...@freelancing-gods.com> wrote:
> You're right about Sphinx not storing the string properly - 0.9.9 and earlier don't have a true concept of string attributes. 1.10-beta does, but Thinking Sphinx doesn't yet support that (I'm working on it).
>
> In the meantime, it's worth reading this:http://freelancing-god.github.com/ts/en/common_issues.html#string_fil...

benoror

okunmadı,
31 Tem 2010 18:00:4531.07.2010
alıcı Thinking Sphinx
Found! Worked this way:

has partner.city.state_name
has "CRC32(state_name)", :as => :state, :type => :integer

And ...

sphinx_scope(:by_state) { | state_name | {
:with => { :state => state_name.to_crc32 }
} }

Thanks a lot!
Tümünü yanıtla
Yazarı yanıtla
Yönlendir
0 yeni ileti