The issue is that store_akas.name is not an array of strings, but one long
string of all the names joined together... if it was Ruby, it'd be
store_akas.collect(&:name).join(' '). So you won't be able to match using the
start/end modifiers for just one of those names within the full field value.
If you want exact matching on column values, then perhaps it's not worth using
Sphinx?
Otherwise, what you could do is add a store_id attribute to your StoreAka
index, and search on that model while grouping by store_id - to ensure you
don't get multiple stores in the search results.
Cheers
--
Pat
On 01/02/2011, at 7:48 AM, zan99 wrote:
> Assuming these two classes and indexes:
>
> class Store < ActiveRecord::Base
> has_many :store_akas
>
> define_index do
> indexes store_akas.name, :as => :akas
> end
> end
>
> class StoreAka < ActiveRecord::Base
> belongs_to :store
>
> define_index do
> indexes :name
> end
> end
>
> This search on StoreAka produces a match:
>
> StoreAka.search('^BlahBlah$', :match_mode => :extended2).blank? =>
> false
>
> While the same call on Store doesn't, even though it should:
>
> Store.search('^BlahBlah$', :match_mode => :extended2).blank? => true
>
> I've verified that the start/end modifiers DO match properly for
> primary attributes of Store -- just not with attributes of the
> StoreAka joined table.
>
> --
> 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.
>
--
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.