lucene 检索不到数据

05-04-18 shineyear

已经成功地将数据库中的数据导入到lucene中

但是始终检索不到任何东西

请高手指点,检索代码如下

public class Search {

private static ChineseAnalyzer chineseAnalyzer = new ChineseAnalyzer();

//protected Analyzer analyzer = new ChineseAnalyzer();

/**@\ufffd\u0439\ufffd

**/

public Hits search(String queryText)throws Exception{

//IndexSearcher searcher = null;

IndexSearcher searcher = new IndexSearcher("/home/lucenetest/index/search");

if (queryText == null){

System.out.println("11111111111111111111111111111111111");

return null;

}

Query query;

System.out.println(queryText);

query = MultiFieldQueryParser.parse(queryText, new String[]{"creationtime"},chineseAnalyzer);

System.out.println(searcher.search(query));

System.out.println(searcher.search(query).length());

return searcher.search(query);

}

}