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
Api search #1782
Api search #1782
Conversation
We need first to support JSONB to actually do queries within arrays in nested JSON.
@alexandermendes this is the first approach for using @> JSONB operator. It's sooo cool and powerful. And the best part is that it's backwards compatible ;-) |
It's important to know that if in your info, you don't pass a proper integer: info="75" PYBOSSA will transform it into a string to make the query valid.
This new query format now allow us to do really complex queries like this:
Basically, you can get to any nested data by writing its path within JSON. This one is like this entities->media -> [{source_user_id: value}] |
Is it limited only if you have an admin API key? Won't such queries hit hard on the database? |
Hi, This works for anyone :-) It won't hit hard at all. Actually, JSONB stores the data efficiently. Also, you can build reverse indexes. I've been testing with Crowdcrafting DB and without an index, it takes around 2s to return something. With an index, it returns it in 0.02 ms. And this is why PostgreSQL is so cool!! Also, you can create specific indexes, as your data may be different due to the JSON free format. |
🍰 🍰 |
This new PR will allow using the @> Postgresql operator within the info fields. Basically, you will be able to get all the domain objects that follow a path like this:
NOTE: you might need to escape your URL if you are using it directly from JS, otherwise chrome does the work for you.