1 11 package org.eclipse.help.internal.search; 12 13 import java.io.*; 14 15 import org.apache.lucene.analysis.*; 16 17 21 public class SmartAnalyzer extends Analyzer { 22 Analyzer pluggedInAnalyzer; 23 Analyzer exactAnalyzer; 24 25 28 public SmartAnalyzer(String locale, Analyzer pluggedInAnalyzer) { 29 super(); 30 this.pluggedInAnalyzer = pluggedInAnalyzer; 31 this.exactAnalyzer = new DefaultAnalyzer(locale); 32 } 33 38 public final TokenStream tokenStream(String fieldName, Reader reader) { 39 if (fieldName != null && fieldName.startsWith("exact_")) { return exactAnalyzer.tokenStream(fieldName, reader); 41 } 42 return pluggedInAnalyzer.tokenStream(fieldName, reader); 43 } 44 } 45 | Popular Tags |