RAMDirectory store = new RAMDirectory();
IndexWriter writer = new IndexWriter(store, new SimpleAnalyzer(), true);
Document d1 = new Document();
d1.add(new Field("field", "a b", Field.Store.YES, Field.Index.TOKENIZED));
writer.addDocument(d1);
writer.optimize();
writer.close();
Searcher searcher = new IndexSearcher(store);
Query query = QueryParser.parse("a NOT b", "field", new SimpleAnalyzer());
//System.out.println(query);
Hits hits = searcher.search(query);
assertEquals(0, hits.length());