Gravatar for

Question by mark, Jul 13, 2015 1:16 PM

How to check if a field exist with data queryBuilder

Hi, I am using the Coveo JSFrameworks. I have a requirement to retrieve results when a certain field is null, empty or undefined. Currently when Coveo indexes the document and there is no data to save to the field, that field is not visible.

Is there any way I can build an advanced query with some condition such as (@myfield==(null))?

Thanks in advance.

1 Reply
Gravatar for

Answer by Jean-François L'Heureux, Jul 13, 2015 1:21 PM

You can use the "NOT" Coveo query operator when defining the query you want to execute:

// This query returns only documents that have no value for the @myfield field.
NOT @myfield
Gravatar for

Comment by mark, Jul 13, 2015 1:39 PM

Hi jflheureux, that worked great.

Thanks a lot.


Ask a question