/** * Set the params (analyzerName only), Comma-separate list of Analyzer class names. If the * Analyzer lives in org.apache.lucene.analysis, the name can be shortened by dropping the o.a.l.a * part of the Fully Qualified Class Name. * * <p>Analyzer names may also refer to previously defined AnalyzerFactory's. * * <p>Example Declaration: {"NewAnalyzer" NewAnalyzer(WhitespaceAnalyzer, SimpleAnalyzer, * StopAnalyzer, standard.StandardAnalyzer) > * * <p>Example AnalyzerFactory usage: * * <pre> * -AnalyzerFactory(name:'whitespace tokenized',WhitespaceTokenizer) * -NewAnalyzer('whitespace tokenized') * </pre> * * @param params analyzerClassName, or empty for the StandardAnalyzer */ @Override public void setParams(String params) { super.setParams(params); final StreamTokenizer stok = new StreamTokenizer(new StringReader(params)); stok.quoteChar('"'); stok.quoteChar('\''); stok.eolIsSignificant(false); stok.ordinaryChar(','); try { while (stok.nextToken() != StreamTokenizer.TT_EOF) { switch (stok.ttype) { case ',': { // Do nothing break; } case '\'': case '\"': case StreamTokenizer.TT_WORD: { analyzerNames.add(stok.sval); break; } default: { throw new RuntimeException("Unexpected token: " + stok.toString()); } } } } catch (RuntimeException e) { if (e.getMessage().startsWith("Line #")) { throw e; } else { throw new RuntimeException("Line #" + (stok.lineno() + getAlgLineNum()) + ": ", e); } } catch (Throwable t) { throw new RuntimeException("Line #" + (stok.lineno() + getAlgLineNum()) + ": ", t); } }