Re: Rest interface: how to match empty fields

Ralf Schlatterbeck <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.devel
Message-ID <[email protected]>
On Sun, Oct 06, 2019 at 12:19:57PM -0400, John P. Rouillard wrote:
> Hi all:
> 
> Does anybody have any ideas on how to ask a rest interface if a value
> is missing? I am working with multilinks specifically, but empty links
> or text fields are also a concern.

You can put "-1" for the ID.

> Use cases:
> 
>    issues that do not have a keyword value set (e.g. no keywords, or null)
-1 for the keyword multilink should do the trick.

>    issues that do not have the FirstTimeFailure (item #7) keyword set
> 
> This is also kind of an issue in the web interface IIRC. E.G. for
> links I can't say must not be item 4, I have to say must be
> -1,1,2,3,5,6,7,8,9. This obviously doesn't work for multilinks as I
> can have both link3 and link 4.

There is a hack that implements an expression parser using special
negative values (like -1 for no value, -2,... is used for specifying
boolean expressions like 'not', 'and', 'or'). See code in and around
_filter_multilink_expression in backends/rdbms_common.py.

There is unfortunately no regression test for this and the
implementation uses subselects (instead of an outer join) but, well, it
sort of works :-) I've encountered at least one case (which I can't
currently reproduce) where it fails when two such searches are
performed in the same query.

And, no, I don't know how to really use this, so a test to document how
to do that would be really nice (I didn't implement this feature :-)

Note that this is only implemented for Multilinks although I see no
reason why it couldn't work on Link, too.

Ralf
-- 
Dr. Ralf Schlatterbeck                  Tel:   +43/2243/26465-16
Open Source Consulting                  www:   http://www.runtux.com
Reichergasse 131, A-3411 Weidling       email: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.