gpt4 book ai didi

solr - 如何获得 MoreLikeThis 结果

转载 作者:行者123 更新时间:2023-12-04 00:41:57 25 4
gpt4 key购买 nike

我试图了解 Solr MorelIkeThis 是如何工作的。我已经完成的步骤 -

  • 在我写的 schema.xml -

  • 字段名称="path_exact"type="string"indexed="true"stored="true"termVectors="true"/>

    字段名称="title"type="text_general"indexed="true"stored="true"multiValued="true"termVectors="true"/>
  • 提到的唯一键

    path_exact
  • 使用以下命令在 solr 中创建索引 -

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

    {"path_exact":"id2","title":"x12"}
  • 现在,当我尝试点击以下网址时,它会返回结果,但我无法理解它到底是什么意思?是不是无法为 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"/>

    谢谢你的帮助!

    最佳答案

    我对你到底做了什么有点困惑,但如果你想设置 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

    关于solr - 如何获得 MoreLikeThis 结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28940996/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com