title: Lucene Custom Analyzer for indexing and query
body: <p>I am working on lucene 4.7 and trying to migrate one of the analyzers we use in our solr configuration. </p>
  
  <pre class="lang-xml prettyprint-override"><code> &lt;analyzer&gt; 
    &lt;charFilter class="solr.HTMLStripCharFilterFactory"/&gt;
      &lt;tokenizer class="solr.WhitespaceTokenizerFactory"/&gt;
      &lt;filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/&gt;  
      &lt;filter class="solr.WordDelimiterFilterFactory" 
              generateWordParts="1" 
              generateNumberParts="1" 
              catenateWords="1"
              catenateNumbers="1"
              catenateAll="0"
              splitOnCaseChange="0"
              splitOnNumerics="0"
              preserveOriginal="1"
      /&gt;
      &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
      &lt;filter class="solr.PorterStemFilterFactory"/&gt;
    &lt;/analyzer&gt;
  </code></pre>
  
  <p>But, I just cannot figure out how to use the HTMLStripCharFilterFactory and the WordDelimiterFilterFactory with the configuration as above. Also, for my query in solr my analyzer is as follows, how can i achieve the same in lucene.</p>
  
  <pre class="lang-xml prettyprint-override"><code> &lt;analyzer type="query"&gt;
      &lt;tokenizer class="solr.WhitespaceTokenizerFactory"/&gt;
      &lt;filter class="solr.StopFilterFactory"
              ignoreCase="true"
              words="stopwords.txt"
              /&gt;
      &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
      &lt;filter class="solr.PorterStemFilterFactory"/&gt;
    &lt;/analyzer&gt;
  </code></pre>