How to check for NULL or empty value in fql (fast search)?

4.5k Views Asked by At

I want to check for null or empty field in fql query , I want to add condition to retrieve result when is column not equal empty or null, I've tried these ways :

     <Context>
     <QueryText language='en-US' type='FQL'>and(string("Text"),not(Column_Name:equals(" ")))
     </QueryText>
  </Context>


     <Context>
     <QueryText language='en-US' type='FQL'>and(string("Text"),filter(Column_Name:not(" ")))
     </QueryText>
  </Context>

I also tried "^$" regular expression instead of empty string , but doesn't work .

any ideas ??

1

There are 1 best solutions below

0
Dan Gøran Lunde On

Think of the index as a key/value lookup. If you check the index of a regular (paper) book, there are no blank entries. I.e. there is no entry in the index that gives you all the pages containing . The search index works the same way. There is no way to query for an empty value.

A common technique is to initialize your fields with some default value like, NODATA. If the field is never written to, it contains NODATA and you know it is empty.