Developer forum

Forum » CMS - Standard features » Index query empty/blank field

Index query empty/blank field

Thomas Larsen
Reply

Hi,

How do I make a query that selects products with a custom field that is empty/blank?

BR
Thomas


Replies

 
Nicolai Pedersen
Reply

Hi Thomas

Lucene does not support that directly - but there is a work around. See the manual: http://doc.dynamicweb.com/documentation-9/platform/indexing-search/indexing-search#2468

BR Nicolai

 
Thomas Larsen
Reply

Thanks, Nice hack :-)

Is there also a way to check if a field of type string[] is "empty" . Meaning that the array do not contains any values?

 
Nicolai Pedersen
Reply

Should be the same thing. Difference is that if the field is of type array, the check is made multiple times - one for each value.

 
Thomas Larsen
Reply

I have tried that, but when saving the query i get an error

 

dw_2016-11-24_11-28-17.png
 
Nicolai Pedersen
Reply

Hm - I can make that save.... Which version are you in?

Capture.PNG
 
Thomas Larsen
Reply

8.8.0.3

 
Thomas Larsen
Reply

I need to do this again on a DW 8.9 and the link (http://doc.dynamicweb.com/documentation-9/platform/indexing-search/indexing-search#2468) don't work anymore.
Can anyone help with the Is null or empty hack on an normal string?

 

 
Nicolai Pedersen
Reply

Hi Thomas

You can find the 9 version here: http://doc.dynamicweb.com/documentation-9/platform/indexing-search/queries#4792

Should be the same on 8.

BR Nicolai

 
Thomas Larsen
Reply

Strange it's not working... But nevermind i will add a custom boolen field to the index handling this

 

You must be logged in to post in the forum