Hello all,
I am trying to search multiple models and have them ordered by the same criteria. This
stack overflow post (by someone else) describes what I am seeing, that the results are implicitly sorted by model first. Is there a way to get this to work so that pagination works correctly?
In my case I have two models: Conversation and Message. Conversation has_many Messages. For the order clause, I set the order to the order of the conversation's subject field. For example
class Message
belongs_to :conversation
searchable do
...
string(:subject) do
self.conversation.subject
end
end
end
class Conversation
has_many :messages
searchable do
...
string(:subject) do
self.subject
end
end
end
Then I want to do
Sunspot.search([Conversation, Message]) do
...
order_by :subject
end
Any help would be greatly appreciated
Steve