String content = "lucene3.0升级后,以前的显示分词结果的语句完全不能用了," + "我们选择分词器是必须的,具体代码如下"; StringReader reader = new StringReader(content); Analyzer analyzer = null; analyzer = new StandardAnalyzer(Version.LUCENE_30); TokenStream ts = analyzer.tokenStream(null, reader); ts.addAttribute(TermAttribute.class); while (ts.incrementToken()) { TermAttribute ta = ts.getAttribute(TermAttribute.class); System.out.println(ta.term()); } 运行结果: lucene3.0升级后以前的显示分 .... .. ...