Ignoring a release when a specific field has any value

In my search query, I’d like to filter out anything that has a secondary type. I tried using the following:

AND secondarytype:\-

  • If a release doesn’t have a secondary type, the field is not displayed, so I get zero results.
    NOT secondarytype:*
  • I think this errors out because it’s an unexpected character.
    NOT secondarytype:\*
  • This actually looks for an asterisk. Which of course doesn’t work.
    NOT secondarytype:%2a
  • My results come through and I don’t get errors, but it doesn’t filter out the releases with a secondarytype like expected.

Is there a way to do this that I’m missing? I’ve read through the Lucene queryparser docs a few times and I just can’t seem to get the results I’m looking for.

1 Like

Alright. I finally figured it out with some regex:

NOT secondarytype:/.*/

Sorry for answering my own question, I thought I had tried everything already. :slight_smile:

4 Likes

Thank you very much @hmhrex.
I have a ridiculously long and prone‐to‐break‐when‐new‐genders‐appear saved search type:person AND NOT gender:male AND NOT gender:female AND NOT gender:other that I can now replace gracefully with type:person AND NOT gender:/.*/.