Jonathan Tran
Jonathan Tran

Reputation: 15306

In Solr, what is the difference between the NOT and - (minus) operators?

In Solr, is there a difference between the NOT and - (minus) operators? If so, what is it?

Solr documentation references the Lucene Query Parser Syntax, and it is vague on this matter. The two operators seem to function the same way, but it's not clear.

Upvotes: 5

Views: 2719

Answers (2)

Xodarap
Xodarap

Reputation: 11849

To expand on Mauricio's answer (because the QueryParser class is some of the most confusing code I've ever read) if you look at lines 145-152 you'll see:

  case MINUS:
    jj_consume_token(MINUS);
             ret = MOD_NOT;
    break;
  case NOT:
    jj_consume_token(NOT);
           ret = MOD_NOT;
    break;

So they are both considered MOD_NOTs.

Upvotes: 5

Related Questions