Relevance Query not returning expected result

Hello,
To build a report, I am using the Bigfix API, specifically the /api/query endpoint.

I’m encountering an issue I can’t figure out. For example, the following query, which aims to return relevant fixlets, displays the expected results:
(name of site of fixlet of it, name of computer of it, id of fixlet of it, name of fixlet of it) of results from (bes computers) whose (relevant flag of it) of bes fixlets

However, I need to query additional properties, such as the fixlet category, severity, and more. Let’s take the category as an example. The query becomes:
(name of site of fixlet of it, name of computer of it, id of fixlet of it, name of fixlet of it, category of fixlet of it) of results from (bes computers) whose (relevant flag of it) of bes fixlets

But in this case, I get significantly fewer results, which is unacceptable for me.

Can anyone explain this issue? Is it a known problem, or am I doing something wrong?

Thanks a lot!

Probably the query is taking out the fixlets with a category not set. You may want to re-write it like

(if exists category of fixlet of it then category of fixlet of it else "N/A"

(not sure if I wrote with the correct syntax)

Agree with @DanieleColi . When I run your second version in the Console’s Presentation Debugger, I do get a ‘singular expression’ error indicating some fixlets have no Category. Depending on how you’re using the API you may get some results along with the error or no results at all, but you should still check for the error on the response to be sure you’re getting complete results.

I checked Daniele’s relevance and it’s working for me with the same result count:

(name of site of fixlet of it, name of computer of it, id of fixlet of it, name of fixlet of it, (if exists category of fixlet of it then category of fixlet of it else "N/A") ) of results from (bes computers) whose (relevant flag of it) of bes fixlets

Another option that might be more succint with a large number of properties is to use the pipe operator | to trap errors and replace with a placeholder result:

(name of site of fixlet of it, name of computer of it, id of fixlet of it, name of fixlet of it, category of fixlet of it | "N/A") of results from (bes computers) whose (relevant flag of it) of bes fixlets

2 Likes

Thank you for your reply.

The property does exist on the computers that weren’t being returned. I finally found a workaround by adding an exists check to the query:

(name of site of fixlet of it, name of computer of it, id of fixlet of it, name of fixlet of it, category of fixlet of it) of results from (bes computers) whose (relevant flag of it) of bes fixlets whose (exists category of it)