[ckan-changes] [ckan/ckan] d3761f: [#1830] datastore_search accepts multiple filters ...
GitHub
noreply at github.com
Thu Jul 3 20:02:42 UTC 2014
Branch: refs/heads/1830-querying-multiple-values-on-the-datastore
Home: https://github.com/ckan/ckan
Commit: d3761f845d1fdf653f08d6a2c5db64884a90c36b
https://github.com/ckan/ckan/commit/d3761f845d1fdf653f08d6a2c5db64884a90c36b
Author: Vitor Baptista <vitor at vitorbaptista.com>
Date: 2014-07-03 (Thu, 03 Jul 2014)
Changed paths:
M ckanext/datastore/db.py
M ckanext/datastore/interfaces.py
M ckanext/datastore/plugin.py
M ckanext/datastore/tests/test_search.py
Log Message:
-----------
[#1830] datastore_search accepts multiple filters values as array
With this patch, if you query the datastore_search with filters:
```json
{
"filters": {
"country": ["Brazil", "Argentina"]
}
}
```
It'll return the rows that have `country IN ("Brazil", "Argentina")`. I had to
change the `datastore_search` extension point on `IDatastore` because I needed
the fields' types. I needed the fields' types because the Datastore accept
fields with array type (e.g. `_text`). When filtering a field that has an array
type, I want to query literally.
In the sample query above, the Datastore can create two different queries,
depending on the type of the `country` field. If it's not an array type, it'll
do as I described above, querying `country IN ("Brazil", "Argentina")`. If it's
of an array type, it'll query literally `country = ["Brazil", "Argentina"]`.
Commit: 2ebc40344511bd35978990b2a93e49dc4c5535cb
https://github.com/ckan/ckan/commit/2ebc40344511bd35978990b2a93e49dc4c5535cb
Author: Vitor Baptista <vitor at vitorbaptista.com>
Date: 2014-07-03 (Thu, 03 Jul 2014)
Changed paths:
M ckanext/datastore/db.py
Log Message:
-----------
[#1830] Keep the fields' order
Commit: 940af3a42645bba836bf5d29775afec56c1795c8
https://github.com/ckan/ckan/commit/940af3a42645bba836bf5d29775afec56c1795c8
Author: Vitor Baptista <vitor at vitorbaptista.com>
Date: 2014-07-03 (Thu, 03 Jul 2014)
Changed paths:
M ckanext/datastore/db.py
M ckanext/datastore/interfaces.py
M ckanext/datastore/plugin.py
Log Message:
-----------
[#1830] IDatastore.datastore_delete() receives fields_types
This is to keep it consistent with .datastore_search(), and make the code
started in d3761f8 work.
Commit: baeefdbdfecf2a13f8034af09f210b1158423c38
https://github.com/ckan/ckan/commit/baeefdbdfecf2a13f8034af09f210b1158423c38
Author: Vitor Baptista <vitor at vitorbaptista.com>
Date: 2014-07-03 (Thu, 03 Jul 2014)
Changed paths:
M ckanext/datastore/db.py
M ckanext/datastore/interfaces.py
M ckanext/datastore/plugin.py
Log Message:
-----------
[#1830] IDatastore.datastore_validate() receives fields_types
This is to keep it consistent with .datastore_search(), and make the code
started in d3761f8 work.
Compare: https://github.com/ckan/ckan/compare/d3761f845d1f^...baeefdbdfecf
More information about the ckan-changes
mailing list