Proposal to support querying attributes with multiple values


#1

@nicolasbulb @complexpoint @Highlander @dan_petter I’m now working to make it easier to query tags that have multiple comma separated values associated. For example @tag(a,b,c). I think most of the difficulty will go away with the addition of a new ‘a’ comparison modifier. When that modifier is present both sides of the comparison will get converted to arrays before the comparison. Here are some examples:

First without any modifier the following query fails to match @tag(a,b,c) because the default is to do a string compare, and because of different whitespace the comparison fails.

@tag = a,b ,  c

On the other hand this next query includes the [a] modifier. That means both the tags value and the value included in the query are first converted to arrays before the comparison. That conversion process splits on , and surrounding whitespace, so this query will match the tag @tag(a,b,c)

@tag =[a] a,b ,  c

I’ve also made the contains and (begins/ends)with predicates array aware. So each of these queries would match @tag(a,b,c)

@tag contains[a] c
@tag contains[a] c,a
@tag beginswith[a] a
@tag endswith[a] a

Let me know what you think. With this syntax in place it should now be possible to also implement clicking on a specific tag value and generating a contains query with that value. Let me know what you think.


#2

Thank you !


#3

Having this would be awesome. I have a quick question,

Since the tag and its data is,

@tag(a, b, c)

How is that still matching this tag? I would assume that the most natural thing would be to have this query to match it,

@tag endswith[a] c

Other than that. I love the idea and the implementation.


#4

Nice idea. But how can we combine case-sensitive search with the array modifier?


#5

Sorry that was typo, as you suggest it should really have been @tag endswith[a] c. I would expect that 99% of the time people will just want to use contains anyway.


#6

Just add the a modifier after the insensitive (I) modifier. So it would look like @tag contains[ia] C,A and still match as described above.


#7

I’ve posted a preview of this support here:

Note that I’ve changed the modifier from a (array) to l (list). I guess list is a more understandable term for many users.