Skip to content
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

[super] Data Query Support #34

Closed
rufuspollock opened this issue Jan 27, 2012 · 6 comments
Closed

[super] Data Query Support #34

rufuspollock opened this issue Jan 27, 2012 · 6 comments
Milestone

Comments

@rufuspollock
Copy link
Member

Query support would involve supporting things like:

  • size / limit (already supported in a limited way)
  • offset
  • order_by / sort
  • filter

This will clearly depend on backend capabilities.

Implementation

  • New Query model object attached to Dataset as query attribute #49 - New Query model object attached to Dataset as query attribute (we make into a Model so we can have event handlers)
    • Dataset can then listen for changes to this object and trigger queries to backend as needed.
    • This also means other things such as a Query editor view within or outside of Recline can take take of updating this object
  • Support in Backends for various of the operations
    • Limit / offset
    • Sorting - Memory backend done in 1491ae5
    • Filtering
  • View support - query editor - Query editor view #53
    • Limit and offset support (plus pagination?)
    • Simple search box
    • Full Query editor - Query editor view #53
       * sort support in DataTable - done in 5fc4fa9

Query Object Proposal

NB: It would be up to specific backends how to implement and support this query object. Different backends might choose to implement things differently or not support certain features.

Propose to base directly ElasticSearch query language. Query object would therefore have following key attributes:

Additions:

  • q: either straight text or a hash will map directly onto a query_string query in backend
    • Of course this can be re-interpreted by different backends. E.g. some may just pass this straight through e.g. for an SQL backend this could be the full SQL query
  • filters: dict of fields with for each one specified a filter like term, terms, prefix, range
    • Value for a field can just be text in which case this becomes a term query on that field
    • E.g. `my-field: 'abc' - would only match results with abc in that field
    • This is a quick way to do filtering.

Examples

{
   q: 'quick brown fox',
   filters: {
     'owner': 'jones'
   }
}

References

Simple 'DIY' Proposal

A query object will have the following attributes:

  • q: a free text query string. It will be up to specific backend implementations how to interpret this.
    • Examples: could be a solr style free text query string
    • Example: could be SQL for an SQL style setup
  • limit: limit the number of items returned by the query
  • offset: offset for start of query results
  • filter: dict/hash of filters keyed by field (header) id. Each filter is a single text string which is used to match against that field name.
@pudo
Copy link
Contributor

pudo commented Jan 27, 2012

big +1 obviously.

@rufuspollock
Copy link
Member Author

@pudo TODO: specify what this looks like in JSON (I need that to serialize it into the url for persistence at the very least ...)

@rufuspollock
Copy link
Member Author

@maxogden @pudo @kindly I'd be interested in your thoughts and feedback on this proposal.

rufuspollock added a commit that referenced this issue Feb 9, 2012
pudo added a commit that referenced this issue Feb 9, 2012
@pudo
Copy link
Contributor

pudo commented Feb 10, 2012

First steps on this are done, now its missing hash url serialization I think?

@rufuspollock
Copy link
Member Author

As this includes sorting this now subsumes #23.

rufuspollock added a commit that referenced this issue Feb 27, 2012
* More natural in fact and we may as well go whole hog with ES structure.
rufuspollock added a commit that referenced this issue Mar 14, 2012
* Also change so that query values are not automatically JSON.stringify-ied (bad idea since it leads to repeated jsonification of same value ...)
rufuspollock added a commit that referenced this issue Mar 23, 2012
…h view updating.

* Problem was in e.g. default demo that with new hash we were not matching on grid view and hence only displaying that (so we displayed both grid and graph which was nasty ...)
* Fix this by better match on route. Also improve by using router.navigate on query update
@rufuspollock
Copy link
Member Author

I'm closing this now. Some backends don't support all of this but we have solid query support not in place in several and it is not clear what exactly remains. As new items arise we can open new tickets.

rufuspollock added a commit to rufuspollock/fd-specs that referenced this issue Feb 25, 2014
…ticSearch (plus ref ElasticSearch in existing work).

* Based on work here datopian/datahub#34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants