【问题标题】:How to get MoreLikeThis result如何获得 MoreLikeThis 结果
【发布时间】:2015-05-10 13:11:27
【问题描述】:

我正在尝试了解 Solr MorelIkeThis 的工作原理。我已经完成的步骤 -

  1. 在 schema.xml 我已经写了 -

field name="path_exact" type="string" indexed="true" stored="true" termVectors="true"/>

field name="title" type="text_general" indexed="true" stored="true" multiValued="true" termVectors="true"/>

  1. 提到的唯一键

    path_exact

  2. 使用以下命令在 solr 中创建索引 -

    {"path_exact":"id1","title":"x1"}

    {"path_exact":"id2","title":"x12"}

  3. 现在,当我尝试点击以下网址时,它会返回结果,但我无法理解这到底是什么意思? id1 和 id2 是否找不到更多类似的商品?如果是,那么我在这里缺少什么?

    http://:/solr/collection2/select?q=x1*&mlt=true&mlt.fl=title&wt=xml

结果 -

 <lst name="moreLikeThis">
     <result name="id1" numFound="0" start="0"/>
    <result name="id2" numFound="0" start="0"/>

感谢您的帮助!

【问题讨论】:

    标签: solr lucene solrj morelikethis


    【解决方案1】:

    我对你到底做了什么有点困惑,但如果你想设置MLT,你可以在你的核心目录中的 solrconfig.xml 中添加一个请求处理程序(我假设 Solr 4.0 及更高版本) .所以大致如下:

        <!-- More Like This -->
    <requestHandler name="/mlt" class="solr.MoreLikeThisHandler">
        <lst name="defaults">
            <!--similar documents defaults-->
            <!--The fields to use for similarity-->
               <str name="mlt.fl">article_title, abstract_text</str>
            <!--Minimum Term Frequency - the frequency below which terms will be ignored in the source doc.-->
               <str name="mlt.mintf">2</str>
            <!--Minimum Document Frequency - the frequency at which words will be ignored which do not occur in at least this many docs.-->
               <str name="mlt.mintf">5</str>
            <!--Minimum word length below which words will be ignored.-->
               <str name="mlt.mintf">0</str>
            <!--Maximum word length above which words will be ignored.-->
               <str name="mlt.mintf">0</str>
            <!--Minimum number of query terms that will be included in any generated query.-->
               <str name="mlt.mintf">25</str>
            <!--Maximum number of query terms that will be included in any generated query.-->
               <str name="mlt.mintf">25</str>
        </lst>
    </requestHandler>
    

    然后在 Solr 上执行一个普通的 HTTP 请求:

    http://localhost:8983/solr/mlt?q="myquery"
    

    或者只是在向“/select”发送请求时设置“&mlt=true”标志?请求处理程序,例如 solr wiki 提供的示例:

    http://localhost:8983/solr/select?q=apache&mlt=true&mlt.fl=manu,cat&mlt.mindf=1&mlt.mintf=1&fl=id,score
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-02
    • 2019-11-06
    • 2014-04-25
    • 1970-01-01
    相关资源
    最近更新 更多