Skip to content
This repository has been archived by the owner on Jun 30, 2018. It is now read-only.

Postgress Json Data type with Rails-4 #954

Open
shamithc opened this issue Mar 24, 2014 · 1 comment
Open

Postgress Json Data type with Rails-4 #954

shamithc opened this issue Mar 24, 2014 · 1 comment
Labels

Comments

@shamithc
Copy link

Thanks for the Retire gem :)

I using Rails 4 and Postgres-9.3 .
Using JSON data types to store Specifications(column: specification_json) inside Product model.
I want to do elastic-search on Product model as per specifications.

#<Product id: 7, prod_id: 525135, cat_id: 6716, category_id: 4335, updated: "2013-09-24 07:37:19",created_at: "2014-03-13 09:40:52", updated_at: "2014-03-20 13:53:27", eans: ["4016032288633"], skus: ["DK-1531-0025/Y"], account_id: 2, specifications_json: {"1368"=>[0.25, 0.36, 0.54],"1371" => ["multi-touch surface", "push button", "scroll button"], "1370"=>["LAN (RJ-45)"], "1369"=>["LAN (RJ-45)"]}>
specifications_json looks like

{ "1368" => [0.25, 0.36, 0.54], "1371" => ["multi-touch surface", "push button", "scroll button"], "1370"=>["LAN (RJ-45)"], ------------ }

I have to query on Product based on this field specifications_json value. Query contains all type of operations like >, <, ==, contains a string etc.

eg:- Lists all products under a category called “Electronics” those specification “Pin-size”(spec key:- 1368) between 0.20 and 0.36 and specification “Screen-feature”(1371) contains string “multi”.

How to filter products based on above conditions?

@karmi
Copy link
Owner

karmi commented Apr 12, 2014

Hey, please check out the https://github.com/elasticsearch/elasticsearch-rails gem, this one is no longer recommended.

@karmi karmi added the waiting label Apr 12, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants