Searchable serialized fields

Hi everyone

Recently I thought about adding a feature that allows to find records by values in a serialized field. For example:

class Article < ActiveRecord::Base   serialize :parameters, Hash end

let's create a sample article to search for:

article = Article.new article.title = 'Sample article' article.parameters = {:foo => "bar"} article.save

and then when if we wanted to find that article by its :foo value we could do something like that:

article = Article.where(:parameters => {:foo => "bar"})

Of course the syntax is just an example, not sure how could that look if implemented.

This would require a database-sided use of regular expressions. But more importantly, would that feature have a use in Rails?

If you serialize as xml instead of yaml, you can make use of xml query functions if your database supports them... mysql and postgres do at least.

This kind of ad-hoc fields, and nested searching is well suited to mongo if you can use it…