Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Mar 26, 2013 @ 15:32
    Rasmus Fjord
    0

    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 "" ?

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Mar 27, 2013 @ 12:23
    Tim
    100

    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/

  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Mar 27, 2013 @ 12:40
    Rasmus Fjord
    0

    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 :)

Please Sign in or register to post replies

Write your reply to:

Draft