ckan/ckan — pull request #1838 by vitorbaptista (2014-07-16 07:43:56+00:00)
Title: Allow full-text searching on specific columns

(This is needed for #1792)

The `datastore_search` API endpoint has a `q` parameter for full-text searchs (FTS). It accepts a string and returns every row that has that string on **any** column.

On #1792 I want to create an autocomplete input for a specific column on a datastore resource. I used this `q` parameter, but as it doesn't search only on a single column, it ends up returning too much rows (check https://github.com/ckan/ckan/pull/1792#issuecomment-48344217 for a better explanation). I need to be able to do a FTS on a single column.

My idea would be to make `q` follow the pattern of the `filters` param. What I mean is that `q` would accept:

```json
{
"q": {
"country": "Braz"
}
}
```

(In the future, it could accept multiple values as well, but let's keep it simple for now)

To keep backwards compatibility, the Datastore would keep the current behavior if you send a string on `q`, but use the new behavior if you send a dict.