Priority: Normal
Current State: No Action Required
Released In: n/a
Target Release: n/a
Applies To: Engine
Component: SEARCH
Branches:
there appear to be several ways to query meta info using where clauses
-
preferences[value=12 AND name='Red']
-
preferences[value=12].Red
-
preferences[value=12][name='Red']
(these can be used for fields too, where there is also the option of
-
Red = 12
additionally, there is the possibility of
-
preferences[value=12 OR attr='Blue'].Red
which is yet another ballgame
these
all get parsed into totally different
Query::Node
structures, resulting in the need more complexity in the Hoisters.
assuming I am correct that these operations are functionally the same, I'd like to post process the Node tree into either the first (the most familiar to me) form, or the third (leveraging set theory style)
--
SvenDowideit - 21 Feb 2011
They are
not quite the same. I'll try and pick them apart. The important thing to remember is that the [where] syntax is the generic method by which query sets are reduced. The . syntax performs double duty - when applied to a single item (or an list containing a single item, IIRC) it behaves as an implicit
[name='']
.
1.
preferences[value=12 AND name='Red']
This reads as "give me the array of META:PREFERENCE where
value=12
and
name='Red'
. Yes, I know there can only be one preference where name='red', but this is a generic query mechanism, where you just happen to be using the
name
field. The array that is returned from this query will either be processed as an array by any containing query, or converted to a scalar (by taking the
value
) if it is used in a scalar context.
2.
preferences[value=12].Red
This reads as give me the subset of preferences where
value=12
; when give me the
value
of any of that set where
name=Red
3.
preferences[value=12][name='Red']
This is functionally identical to (2), because
.Red
is a synonym for [name='Red']=
4.
preferences[value=12 OR attr='Blue'].Red
Reads as "give me the set of preferences where
value=12
or
attr='Blue'
. Then give me the
value
of any of that set where the
name
is
Red
(the synonymic form of .Red)
--
CrawfordCurrie - 21 Feb 2011
I've explained forms 1 & 3 to my users, but never 2 or 4.
I had difficulty imagining what 2 & 4 would do, but after Crawford's explanation, I
guess it's consistent.
--
PaulHarvey - 21 Feb 2011
Closing No Action. If a processor needs to tranform the tree, it can - that's part of how I did the search in the
DBIStoreContrib.
--
CrawfordCurrie - 29 May 2014