Hi all,

Is there a way to index the results of an arbitrary SQL query as an
MVA?  I'm trying to index the ancestor ids of records in a table that
implements nested sets, and I want to index something like

SELECT id FROM `taxa` WHERE (taxa.`lft` <= 5691 AND taxa.`rgt` >=
5692) ORDER BY `lft`

for each record, but I'm not sure how.  My best attempt was

has "(SELECT id FROM `taxa` WHERE (taxa.`lft` <= lft AND taxa.`rgt` >=
rgt) ORDER BY `lft`)", :as => :self_and_ancestors_ids, :type => :multi

but that just creates invalid SQL (Subquery returns more than 1 row).
I'm using the awesome_nested_set Rails plugin, which wraps these
queries in named scopes, so I also tried

has self_and_ancestors(:id), :as => :self_and_ancestors_ids, :type
=> :multi

but it only seems to index the id of the current record, not itself
and all its ancestors.

Anyone have any ideas on how I can index these ancestor IDs?

-Ken-ichi

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to