I recently wanted to come up with a solution to searching by a
category (E.g. Shoes), sub category (E.g. Shoes > Blue), or sub sub
category to any depth. This represents an obvious DB challenge not to
mention model objects in RoR. I've come up with an elegant solution
using Binary Trees and thought it might be useful to others. I've
documented it here:

http://web.me.com/adamfowleruk/adamslife/Blog/Entries/2009/1/13_A_Strategy_for_Hierarchical_Searches_in_a_single_SQL_entity_table.html

Note I've not used it in anger yet, and have not QA'ed the Ruby and
Java code at the end of the entry, but the approach is simple enough
and easy for anyone to pick up.

Category searching to any depth using 1 column/model variable. 8o)

I'd appreciate any feedback, especially if anyone can think of a more
elegant way to do it?

If anyone knows of where best to place the re-implementation of the
sqlite3 LIKE function in a RoR project I'd be grateful. I'll likely
use it elsewhere too. (I may infact implement REGEXP rather than re-
implement LIKE).

Regards,

Adam.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to