Gravatar for mark.angus@sitesystems.ca

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 jflheureux@coveo.com

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: https://onlinehelp.coveo.com/en/ces/7.0/user/coveoquerysyntax_reference.htm

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

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

Hi jflheureux, that worked great.

Thanks a lot.

Mark

Ask a question