使用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搜索不到,而第三个搜索到的是错的? 怎么修改才能查找到正确的结果
- 1 回答
- 0 关注
- 883 浏览
添加回答
举报
0/150
提交
取消