Opened 12 years ago

Closed 11 years ago

#5510 closed enhancement (fixed)

dojo.data query supporting OR operations

Reported by: guest Owned by: Jared Jurkiewicz
Priority: high Milestone: 1.2
Component: Data Version: 1.0
Keywords: data query Cc:
Blocked By: Blocking:

Description (last modified by Jared Jurkiewicz)

A dojo.data query only supports ANDing clauses together by its nature, but ORing is really necessary in my book. It would be nice to see that implemented, maybe even a SQL syntax (for which you don't need an underlying SQL- driven database, just think of http://search.cpan.org/dist/SQL-Abstract/lib/SQL/Abstract.pm).

But the focus lies on adding OR/NOT/XOR support to a query. Maybe like this:

{ query: { name: { or: ["sam", "tom"] } }

Or maybe:

{query: {name: "sam||tom"} }

More versatile would be an optional user defined callback:

{query: function(item) { return (item["name"] == "sam" || item["name"] == "tom"); } }

Change History (4)

comment:1 Changed 12 years ago by Dustin Machi

Note that dojo.data doesn't define any particular query structure, its is the stores themselves that define the query structure. jsonPathStore also does support more sophisticated queries, however it is not included in any release version of dojo yet and there are a few cases where we need to make some modifications to widgets to ensure they stay query language agnostic for it to be more useful.

comment:2 Changed 12 years ago by Jared Jurkiewicz

User defined functions would be pointless if the store is a pass through to a server. There is no guarantee the back end server could handle JavaScript?.

The other options might be feasible, but we do state the query syntax is more or less up to the store, but we do make recommendations on a minimal sort of format that would be good if all stores supported (so widgets can work fairly easily with them).

comment:3 Changed 11 years ago by dylan

Milestone: 1.2
Summary: dojo,data query supporting OR operationsdojo.data query supporting OR operations

comment:4 Changed 11 years ago by Jared Jurkiewicz

Description: modified (diff)
Resolution: fixed
Status: newclosed

A user submitted a store that supports an and/or query synta that was basedon ITemFile store. After review and some cleanup, it has been committed into dojox. (dojox.data.AndOr?*Store)

Note: See TracTickets for help on using tickets.