make "in" work with "right"

Support Ticket

+status
 

I worked around this by using "linked_to_by" (I was already using "referred_to_by") but this will break when we store Pointer items as inclusions. Not good to encourage such hacks.

 

does "or" work?  Maybe we need to unify "in" and "or".  "or" is supposed to work with card defs, "in" isn't.

(I think "or" and "and" should be changed to "any" and "all" respectively, fwiw)


"or" doesn't get around the problem that JSON can't handle duplicate keys. So in this case, I worked around using "or", but that only worked because I was able to use "referred_to_by" and "linked_to_by". Which will eventually break, as mentioned.

  --John Abbe.....Fri Dec 17 12:10:43 -0800 2010


I like any & all.

  --John Abbe.....Fri Dec 17 12:11:03 -0800 2010


Actually, it looks to me like this already works just fine with: {"right":{"name":["in","patterns","other patterns"]}} (see http://grouppatternlanguage.org/wagn/Ethan_McCutchen+test_search).

 

I'm not sure what syntax you were trying, but remember that "in" is an operator, not a relationship. (see CQL Syntax). So if you were trying something like this:

 

{"right":["in","patterns","other patterns"]}

 

...then you were trying to use an OPERATOR (in) on a RELATIONSHIP (right). But it can only apply to properties (name)

 

I can imagine wanting this to work:

 

{"right":{"in":["patterns","other patterns"]}}

 

and it probably actually comes close, but when you don't specify what property (in this case, "name") that the values are supposed to be "in", then it does a name/content match. That is true of all operators (see the OPERATOR:VALUE syntax)

 

Unless you're seeing something else that I don't, I recommend closing this card.

  --Ethan McCutchen.....Fri Dec 17 12:58:28 -0800 2010


Do we actually have an example of a problem here? I was looking at the link referred to in the example, and it looks to me like it doesn't use "in" at all. Though perhaps it should. I haven't testing this, but it looks to me like you could simplify the following:

 

{"or": {"referred_to_by": {"left": "_left", "right": "Patterns" },
"linked_to_by": {"left": "_left", "right": "other patterns"},
"and": {"linked_to_by": {"left": "_left", "right": "suggested patterns"} }
},"prepend": "_self"
}

 

to:

 

{"referred_to_by":{"left":"_left", "right":["in","Patterns","other patterns","suggested patterns"]},
"prepend": "_self"
}

  --Ethan McCutchen.....Fri Jan 28 16:27:09 -0800 2011


That's what I was trying originally, and it doesn't work:

 

RuntimeError: Invalid cardspec args ["in", "Patterns", "other patterns", "suggested patterns"]

 

See http://grouppatternlanguage.org/wagn/John_Abbe+test_search and an even simpler example is one version back in Changes (Yeah, I'll make an example on test at some point...). I should've included the error message in the first place, guess my main focus at the time was getting something to work for the Pattern Language of Group Process wiki, not reporting the bug.

  --John Abbe.....Fri Jan 28 22:52:53 -0800 2011


oh, yes my mistake. "right" need a card spec (in other words, a valid self-standing WQL query). so this should work:

 

{"right":{"name":["in","Patterns","other patterns","suggested patterns"]}}

 

semi tested on your test search card

  --Ethan McCutchen.....Sat Jan 29 10:32:44 -0800 2011


That did it, thx.

  --John Abbe.....Sun Feb 13 21:15:06 -0800 2011