使用IKAnalyzer作为分词器,在索引中写入如下两个域:
TextField field1 = new TextField("content","hello你好",Store.YES);
TextField field2 = new TextField("content","Yello你好",Store.YES);
在搜索的时候
Term term = new Term("content", "Yello你好");
TermQuery termQuery = new TermQuery(term); //搜索不到
Term term = new Term("content", "Y*");
WildcardQuery wildcardQuery = new WildcardQuery(term);//搜索不到
String params ="(content:"+"Y*)";
QueryParser parser = new QueryParser(params, new IKAnalyzer());
Query query = parser.parse(params);//能搜索到,结果是""hello你好"
求解释一下为什么前两个query搜索不到,而第三个搜索到的是错的? 怎么修改才能查找到正确的结果
饮歌长啸