How to write code to search serialize object in rails3 with PG sql

My code is this
<Product id: 44, data: {:my_data=>{“1”=>“5”, “2”=>“test”, “3”=>“tes”}}, view_cout: 1>

How I can write code to search project from “my_data” key or value ?

I have search and found there is one way by hstore we can achieve it ( https://github.com/diogob/activerecord-postgres-hstore) but in this sense I have to change current logic of storing data also I have to move the current data to new fild if I use this.

Is there any good way which take less changes or if not then what should I do to create filter for it.

You might want to consider the Postgres JSON support - it will allow for queries deep into the data.

BUT you should first think hard about whether this should be a serialized field at all; one of the primary tradeoffs you make with serialized fields vs. storing the data broken out into related records is searchability. If you’re going to be querying the values extensively, maybe an alternative approach within your DB is better - or perhaps even a secondary indexing system (Solr / ElasticSearch / etc).

–Matt Jones