0

I have a SOLR document which looks like this:

<doc>
    <float name="score">1.7004467</float>
    <str name="name">Love</str>
    <str name="id">15801637</str>
    <int name="itemCount">3</int>
    <date name="last_modified">2012-08-10T11:04:28Z</date>
    <str name="emailaddress"/>
</doc>

<doc>
    <str name="name">Love</str>
    <str name="id">158015757</str>
    <int name="itemCount">3</int>
    <date name="last_modified">2012-08-10T11:04:28Z</date>
    <str name="emailaddress">xxx@yy.com</str>
</doc>

I want to write a query that matches documents by name, but boost records with emailaddress to appear on top, and without emailaddress toward the bottom.

I don't want to sort by email address. I prefer using dismax (i am presenting a simplified problem here).

4

1 回答 1

0

检查例如Boost Score或如果您使用 Dismax 解析器检查参数Boost Query

emailaddress:[* TO *]应包含具有值的电子邮件地址

根据你的情况你可以试试bq=emailaddress:[* TO *]^2.0

于 2013-01-31T09:08:49.987 回答