On Jul 26, 8:02 pm, Graham Glass <[email protected]> wrote:
> I'd prefer for architectural reasons that these classes to not share a
> common base class. So I'd like to to index instances of A, B and C
> (each now standalone classes) then then issue a search that says
> "return all the objects that have value = 'xxx'". (maybe Object.search
> () or something like that). Since A, B and C each have a field called
> "value", I'd like to get back all the As, Bs and Cs that match.
Pat Allan wrote:
> There is indeed a way:
> ThinkingSphinx.search :conditions => {:value => 'xxx'}
I also would like to create an index with sources from multiple
models. It sounds like for you it is enough to be able to search
across multiple indexes. I wonder, however, if there might not be a
benefit to actually creating a single index with multiple sources.
In other words, something like this:
index profile_core
{
source = user_core_0
source = group_core_0
...
}
If I tweak Builder#define_source to accept a model as the first arg,
then I can create the above config like this:
class Profile
define_index do
define_source(User) do
indexes :name
end
define_source(Group) do
indexes :name
end
end
end
My goal is to have a single index with sources from a half dozen
models all using a rather complicated permission resolution system
that uses multi value attributes. I only ever want to search these
models together, so it make sense to me to combine them into a single
index.
I guess I have two questions:
(1) is there any benefit to a single index versus searching across
multiple indexes?
(2) if I submitted a patch of sufficient quality that added an
optional model argument to define_source, what are the chances that it
would get accepted?
thanks,
-elijah
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---