title: Searching for Terms with whitespace using Lucene
body: <p>I'm trying to use Lucene to add a search feature but can't seem to get an index to work with significant whitespace. I've got the following test case setup:</p>
  
  <pre><code>RAMDirectory directory = new RAMDirectory();
  KeywordAnalyzer analyzer = new KeywordAnalyzer();
  IndexWriterConfig config = new IndexWriterConfig(analyzer);
  IndexWriter writer = new IndexWriter(directory, config);
  Document doc = new Document();
  doc.add(new TextField("content", "Bill Evans", Field.Store.NO));
  writer.addDocument(doc);
  writer.close();
  
  IndexReader reader = DirectoryReader.open(directory);
  IndexSearcher searcher = new IndexSearcher(reader);
  
  QueryParser parser = new QueryParser("content", analyzer);
  parser.setSplitOnWhitespace(false);
  Query query = parser.parse("Bill E");
  
  TopDocs docs = searcher.search(query, 1);
  assertTrue(docs.totalHits &gt; 0);
  </code></pre>
  
  <p>I'm using Lucene 6.6.0 and from what I understand the <code>KeywordAnalyzer</code> is what I'm looking for:</p>
  
  <blockquote>
    <p>"Tokenizes" the entire stream as a single token. This is useful for data like zip codes, ids, and some product names.</p>
  </blockquote>
  
  <p>But I can't seem to get any matching documents that contain whitespace. </p>
  
  <p>Any ideas on how to solve this?</p>