Solr Boosting自定义字段

时间:2014-09-22 13:20:04

标签: solr search-engine

Solr Experts,

我试图通过索引时间/字段提升来改变我的一些自定义字段的分数,但似乎没有改变分数。请帮忙。

这些是schema.xml中的自定义字段

 <field name="doc_id" type="string" indexed="true" stored="true" omitNorms="false"/>
 <field name="doc_name" type="text_autocomplete" indexed="true" stored="true" multiValued="true" omitNorms="false"/>
 <field name="doc_author" type="text_autocomplete" indexed="true" stored="true" multiValued="true" />
 <field name="modifieddate" type="text_autocomplete" indexed="true" stored="true" multiValued="true"/>
 <field name="doc_content" type="text_autocomplete" indexed="true" stored="true" multiValued="true" omitNorms="false"/>
 <field name="doc_title" type="text_autocomplete" indexed="true" stored="true" multiValued="true"/>
 <field name="doc_description" type="text_autocomplete" indexed="true" stored="true" multiValued="true" omitNorms="false"/>

我使用SolrJ

发布了以下3个测试文档
<?xml version="1.0" encoding="UTF-8"?>
<add>
  <doc>
   <field name="doc_id">7781</field>
   <field name="doc_name" boost="1.5">Cat</field>
   <field name="doc_author">Nsd80</field>
   <field name="modifieddate">11 30</field>
   <field name="doc_content" boost="1.5">Cat life history. Cat life cycle. Cat Foods</field>
   <field name="doc_title">Titled</field>
   <field name="doc_description" boost="1.5">Cat related details</field>
  </doc>
  <doc>
     <field name="doc_id">7782</field>
     <field name="doc_name" boost="2.5">Dog</field>
     <field name="doc_author">Nsd80</field>
     <field name="modifieddate">11 30</field>
     <field name="doc_content" boost="2.5">Dog life history. Dog life cycle. Dog Foods</field>
     <field name="doc_title">Titled</field>
     <field name="doc_description" boost="2.5">Dog details</field>
  </doc>
  <doc>
     <field name="doc_id">7783</field>
     <field name="doc_name" boost="2.7">Cow</field>
     <field name="doc_author">Nsd80</field>
     <field name="modifieddate">11 30</field>
     <field name="doc_content" boost="2.7">Cow life history. Cow life cycle. Cow Foods</field>
     <field name="doc_title">Titled</field>
     <field name="doc_description" boost="2.7">Cow lifecycle</field>
  </doc>
</add>

当我查询以查找如下分数时,

localhost:8983/solr/select/?q=doc_id:*&fl=*,score

它显示所有三个文档的得分为1.0

我试图将它们提升为

localhost:8983/solr/select?defType=edismax&q=doc_description:*Cow*^195

但似乎无法正常工作

<arr name="doc_description">
<str>Dog details</str>
</arr>
<long name="_version_">1479948142366425088</long>
<float name="score">1.0</float>
</doc>
<doc>

还试图提升为

localhost:8983/solr/elevate?q=doc_id:7781&enableElevation=true&fl=doc_id,score,[elevated]

但结果是否定

<result name="response" numFound="1" start="0" maxScore="7.23343">
<doc>
<str name="doc_id">7781</str>
<float name="score">7.23343</float>
<bool name="[elevated]">false</bool>
</doc>
</result>
</response>

我的要求只是提升文档以获得更多分数,以便我可以根据分数检索它们。如果您查看我的xml文档,我在索引时尝试了字段提升,之后尝试使用edismax(mentioned here)以及elevation

来提升文档

任何人都可以帮我详细说明一下吗?

0 个答案:

没有答案