neufang / ik-analyzer

Automatically exported from code.google.com/p/ik-analyzer
0 stars 0 forks source link

solr4.0使用stopword查询问题 #100

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
  IK Analyzer 2012FF_hf1结合solr4.0,使用stopword.dic里的停止词查询出现如下问题。
  index:
        SolrInputDocument doc2 = new SolrInputDocument();
    doc2.addField( "id",11111111111l);
        doc2.addField( "intro", "core1 and test with will");
    doc2.addField( "name", "test");
    server1.add(doc2);
    server1.commit();
  search1:
        String q="intro:will";
        SolrQuery solrQuery = new SolrQuery(q);
    QueryResponse response = server1.query(solrQuery);
    System.out.println("Find:"+ response.getResults().getNumFound()); 
    结果是Find:0
  search2:
        String q="intro:will AND name:test";
        SolrQuery solrQuery = new SolrQuery(q);
    QueryResponse response = server1.query(solrQuery);
    System.out.println("Find:"+ response.getResults().getNumFound());
    结果是Find:1

  其中域name和intro都是用IK进行分词的,will是stopword.dic里的停止词,按道理
search2的查询的且关系应该和search1结果相同才对,为什么却能
找到结果呢?而实际上String q="intro:a AND name:test"和String 
q="intro:it AND 
name:test"(只要intro对应的是停止词+AND的方式依然能得到结果�
��,求解。

Original issue reported on code.google.com by xianyong...@126.com on 7 Dec 2012 at 5:16

GoogleCodeExporter commented 9 years ago
你问啥不跟踪一下q字串被转化成SolrQuery后的实际逻辑是什么�
��?

实验IK分词是否正常,直接测试分词结果就好,你把它和搜索
结果和在一块,然后要分词器来给解释!!?你觉得合理么?

Original comment by linliang...@gmail.com on 9 Dec 2012 at 7:15