Hi there,
i wrote an intelligent searchform, which is divided into categories. Just a short overview of the workflow. For every keyword, which is entered in the searchform the matches are checked. So we've got a rank in a hash.
[key of entry, relevance match]
For example: @hash = [123 => 5, 124 =>2, 125 => 5, 126 => 1, etc...]
I ordered the Hash "by relevance" simply by ordering by the hash values: @hash.sort_by {|a,b| b})
@hash = [123 => 5, 125 => 5, 124 =>2, 126 => 1, etc...]
No I want to find my entries by the key values of the hash.
Thats not the problem: @entries = Entry.find(@hash) or @entries = Entry.find(@hash.keys)
The problem is, that the entries are (by standard) ordered by ID and not in order by the Hash-Keys I passed. Is there a possibility to order by my "relevance system" (even if there isn't a coloumn in the Entries-Table.
Thank you 'till now Hans