Solr More Like This (MLT) 不返回结果

标签 solr django-haystack morelikethis pysolr

我目前正在寻求基于我的索引中的多个字段来实现更多类似的功能。

我目前的配置如下: 干草堆 | PySolr |太阳能

对于这篇文章,我使用 PySolr 并将参数传递给 more_like_this 函数。响应找到文档,但没有找到任何相关结果。这是为什么呢?

这是我点击的网址:

http://localhost:8080/solr/mlt?q=django_id:12123412&mlt.fl=industry_ids,loc_state,amount,sector_id&mlt.interestingTerms=details

这是我从 Solr 得到的回复:

<response>
<object type="{XXXXXX-0F1D-4F28-AAA2-XXXXXXXXXXX}" cotype="cs" id="cosymantecbfw" style="width: 0px; height: 0px; display: block;"/>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">24</int>
</lst>
<result name="match" numFound="1" start="0">
    <doc>...</doc>
</result>
<result name="response" numFound="0" start="0"/>
<lst name="interestingTerms"/>
</response>

solrconfig.xml

<!-- More Like This -->
<requestHandler name="/mlt" class="solr.MoreLikeThisHandler">
</requestHandler>

schema.xml

<field name="award_amount" type="sfloat" indexed="true" stored="true" multiValued="false" termVectors="true" />
<field name="estatus" type="slong" indexed="true" stored="true" multiValued="false" termVectors="true"/>
<field name="loc_state" type="string" indexed="true" stored="true" multiValued="false" termVectors="true"/>
<field name="orgtype_id" type="string" indexed="true" stored="true" multiValued="false" termVectors="true" />
<field name="sector_id" type="string" indexed="true" stored="true" multiValued="false" termVectors="true"/>
<field name="industry_ids" type="string" indexed="true" stored="true" multiValued="true" termVectors="true" />
<field name="award_amount_exact" type="sfloat" indexed="true" stored="true" multiValued="false" termVectors="true" />
<field name="sector_id_exact" type="string" indexed="true" stored="true" multiValued="false" termVectors="true"/>
<field name="amount_exact" type="sfloat" indexed="true" stored="true" multiValued="false" termVectors="true"/>

任何帮助将不胜感激!

最佳答案

您的文本字段必须具有 text 类型,它会处理它们以使它们可搜索string 字段按原样存储和查询,因此不可搜索,使其对 MLT 无用。

如果您想存储与 textstring 相同的数据(例如,分面),请引用 copy fields


我看到您还打算找到最接近我们查询的数字。 MLT 不适合这种情况。您想为此编写一个函数查询SolR : More Like This on number fields

关于Solr More Like This (MLT) 不返回结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9304464/

相关文章:

crash - Solr从属复制服务器无法启动

java - 如何在 Linux 上使用 plesk 为基于服务的 tomcat 版本设置 JAVA_OPTS?

搜索表示与特定关键字相关的图形的算法

solr - 将文件发布到 solr 时出现未知命令错误

django - 从 haystack 索引中删除对象

django - Django的干草堆elasticsearch自动完成不起作用

zend-framework - Zend Lucene

elasticsearch - min_doc_freq如何在“类似此查询”中工作?

node.js - Elasticsearch:更像是对多种索引类型的查询

java - Nutch 抓取后的 Solr 索引失败,报告 "Indexer: java.io.IOException: Job failed!"