-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can search_cop work with Postgres hstore? #58
Comments
hi, search_cop tries to be as database agnostic as possible and hstore is postgres only, but yeah, this can be made to work. Bit of a question is, as you already pointed out, how you specify the attributes, but it's definitely possible and i'd be willing to integrate it. |
I might try to tinker with it next week. For my use case, this is better: Profile.search "settings.color = yellow" since the whole reason for using hstore, is to allow completely arbitrary fields, so I need to avoid the requirement to define them as a search scope option. |
After looking at the code, and some failed attempts, I opted to ditch this hstore direction since it looks like too much work (mostly due to the fact that I am unfamiliar with the code). If nobody else can / want to pick up this glove, feel free to close this issue (although I think it would be a cool feature still). |
i'll dig into it. |
Thank you! And I love this gem, it literally saves me a lot of time, so I am more than willing to contribute and help where I can. |
You can already take a look into #60 Please note that it is not easily possible (by design) to allow access to arbitrary fields of an hstore/jsonb field by via some dot syntax ( |
Thanks for investing your time into it Alright, I looked at the code. So, if I understand correctly it will allow me to use one of json stores, and still search inside it using searchcop standard syntax, assuming I declare them in the model like any other search cop field. Right? If so, this is great! |
it's available now |
(somewhat related to #31)
I am evaluating my options in regards to having arbitrary data that is still searchable in Rails and Postgres. One option I am looking at is the Postgres hstore structure.
Is there any chance that this can work with search_cop?
Searching a table with hstore column, looks like this:
I would love to have something much simpler in search_cop - specifically in the string search format - maybe like this:
Or perhaps an alternative (additional) approach:
and then, we can just use the plain attribute name (without column name prefix):
If this works - or can be made to work - this would be super cool.
The text was updated successfully, but these errors were encountered: