not, nnot modes

NOT and NNOT Searches

NOT is a logic operation, also known as an inversion or negation. In logic, negation is also called the logical complement (1).

When applied to the ouput of another logic operation, NOT inverts said ouput. Thus, NOT, OR, XOR, and AND each followed by NOT yields the NNOT, NOR, XNOR, and NAND complementary operations. In a sense, this is like inverting the colors of a two-color picture. Here NNOT is short for NOT NOT (a double negation).

When NOT is applied to each bit of a byte, the result is a bitwise negation operation, also known as a bitwise NOT or ones' complement operation because 1's and 0's are swapped.

In C-like programming languages like JavaScript, NOT is represented with an exclamation character ("!"), a bitwise negation with a tilde character ("~"), and a double negation with two exclamation characters ("!!"). A double negation returns false when applied to a "falsy" value; otherwise returns true. A "falsy" value is one that is false, 0, NaN, undefined, null, or an empty string (""). All other values are truthy, including true, empty functions, empty arrays, empty objects, and strings (2, 3).

Applications to IR

A NOT operation can be applied to information retrieval problems. For instance, preceeding a search term with the NOT operator instructs a search engine not to match documents with the negated term. Minerazzi uses a similar convention, except that search terms must be declared after the negated term, like this

NOT:negated_term (search_terms) (1)

where the paretheses are optional. So the query

NOT:w2 (w1 w2 w3)(2)

excludes documents with w2 from the search results and is equivalent to querying directly

NOT:w2 w1 w3 (3)

The following figure illustrates this search.

NOT searches

The colored region represents the subsets of documents matching this search (NOT matches), and the white region the subsets of documents not matching the search (NNOT matches). The empty subset { } is the number of documents matching none of the search terms.

Final Remarks

Minerazzi supports the NOT search mode and its complement. This mode helps users narrow down their searches by excluding documents from a results set.


  1. Wikipedia. (Accessed on 1-1-2014). Negation.
  2. Buckler, C. (2009). Truthy and Falsy: When All is Not Equal in JavaScript.
  3. Padolsey, J (2011). Truthy & Falsey.