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);
QueryParser parser = new QueryParser("field", new SimpleAnalyzer());
Query query = parser.parse("a NOT b");
//System.out.println(query);
Hits hits = searcher.search(query);
assertEquals(0, hits.length());