package lux.index.analysis;

import java.io.Reader;

import lux.index.IndexConfiguration;

import org.apache.lucene.analysis.ASCIIFoldingFilter;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.LowerCaseFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.standard.StandardTokenizer;

public final class DefaultAnalyzer extends Analyzer {

    @Override
    public TokenStream tokenStream(String fieldName, Reader reader) {
        return new LowerCaseFilter(IndexConfiguration.LUCENE_VERSION, 
                new ASCIIFoldingFilter(
                        new StandardTokenizer(IndexConfiguration.LUCENE_VERSION, reader)));
    }

}

/*
 * This Source Code Form is subject to the terms of the Mozilla Public License,
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
 * obtain one at http://mozilla.org/MPL/2.0/.
 */

@@ -172,22 +172,29 @@
 nalysis.
-Analyz
+LowerCaseFilt
 er;%0Aimpo
@@ -219,39 +219,44 @@
 ne.analysis.
-LowerCaseFilter
+ReusableAnalyzerBase
 ;%0Aimport org
@@ -292,16 +292,61 @@
 Stream;%0A
+import org.apache.lucene.analysis.Tokenizer;%0A
 import o
@@ -443,24 +443,32 @@
 extends 
+Reusable
 Analyzer
  %7B%0A%0A    
@@ -459,16 +459,20 @@
 Analyzer
+Base
  %7B%0A%0A    
@@ -486,21 +486,24 @@
 de%0A    p
-ublic
+rotected
  TokenSt
@@ -510,20 +510,35 @@
 ream
- tokenStream
+Components createComponents
 (Str
@@ -581,14 +581,130 @@
     
-return
+Tokenizer tokenizer = new StandardTokenizer(IndexConfiguration.LUCENE_VERSION, reader);%0A        TokenStream tokenStream = 
  new
@@ -799,98 +799,84 @@
 ter(
-%0A                        new StandardTokenizer(IndexConfiguration.LUCENE_VERSION, reader))
+tokenizer));%0A        return new TokenStreamComponents(tokenizer, tokenStream
 );%0A 

make DefaultAnalyzer reusable