Currently in Lucene this isn't possible. One way around it is to use the Examine/Lucene events system to set the field to something like "null" or "empty" when it's being indexed if there's nothing in it, that way you can test for empty ones. You could also set an additional field to say if it was empty or not. It's a bit hacky, but it's the main way I've seen of accomplishing this. Ismail mentions it in his series of articles on the Cogworks blog: http://thecogworks.co.uk/blog/posts/2012/november/examiness-hints-and-tips-from-the-trenches-part-2/
Examine checking if a field is not empty
Hey guys :)
I could see that others have been asking this question but does not seem to be answered yet.
Is there anyway to query examine/lucene to get all documents where some field is not "" ?
Currently in Lucene this isn't possible. One way around it is to use the Examine/Lucene events system to set the field to something like "null" or "empty" when it's being indexed if there's nothing in it, that way you can test for empty ones. You could also set an additional field to say if it was empty or not. It's a bit hacky, but it's the main way I've seen of accomplishing this. Ismail mentions it in his series of articles on the Cogworks blog: http://thecogworks.co.uk/blog/posts/2012/november/examiness-hints-and-tips-from-the-trenches-part-2/
Hey Tim :)
Thx for answering so quickly.
It could be achived with that way around, I worked around it in another way.
Since i wanted every document where some specific field was NOT empty i did this myField : [0 TO 999999999999]
Since the field could only contain numbers this gave just what i needed :)
is working on a reply...