title: What analyzer should I use so that I get hits for mispelled words?
body: <p>I am writing a full text search functionality in my project using Lucene 4.3
  Everything works just fine when i add data but when querying I only get hits only if at least one word in the query matches at least one word in the value of a field in the index.</p>
  
  <p>eg if i add</p>
  
  <pre><code>private static StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_43);
  public static void addCustomerDoc(Map&lt;String, String[]&gt; parameters, String path, long customerId) throws IOException {
      File file = new File(path + "/index/");
      FSDirectory indexDir = FSDirectory.open(file);
      IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_43, analyzer);
      IndexWriter writer = new IndexWriter(indexDir, config);
      Document doc = new Document();
      doc.add(new TextField("email", parameters.get("email")[0].toString(), Field.Store.YES));
      doc.add(new TextField("username", parameters.get("username")[0].toString(), Field.Store.YES));
      doc.add(new TextField("phone", parameters.get("phone")[0].toString(), Field.Store.YES));
      doc.add(new StringField("customerId", "" + customerId, Field.Store.YES));
      addDoc(writer, doc);
      writer.close();
  }
  
  private static void addDoc(IndexWriter writer, Document doc) throws IOException {
      writer.addDocument(doc);
      writer.commit();
  }
  </code></pre>
  
  <p>adding a user like </p>
  
  <ol>
  <li>username = foobar</li>
  <li>email = foobar@example.com</li>
  <li>phone = 0723123456</li>
  </ol>
  
  <p>if i search for foo, fooba or foobarx i get no hits shouldn't I get a result even if I typed f or exceeded the word foobar?</p>