简体   繁体   English

使用multiValued中的一个单词匹配来提高solr结果

[英]Boost solr results with one word match from multiValued

I have solr schema with certain fields: 我有某些领域的solr模式:

<field name="id" type="integer" indexed="true" stored="true" required="true" multiValued="false" />
<field name="title" type="text" indexed="true" stored="true" multiValued="false" />
<field name="note" type="text" indexed="true" stored="true" multiValued="false" />

Now i searching over it with query (where %s is my search string) 现在我用查询搜索它( %s是我的搜索字符串)

q={!boost b=recip(ms(NOW,date),3.16e-11,1,1)}%s&defType=dismax&qf=title^100 note

and i need something like tags for each record. 而且我需要为每条记录添加类似标签的内容。

<field name="tags" type="string" indexed="true" stored="false" multiValued="true" />

How can i boost results for that records, where one of words match one of value from "tags" field? 如果单词之一与“标签”字段中的值之一匹配,我如何提高该记录的结果?

update 更新

Just figured out, that if i remove {!boost b=recip(ms(NOW,date),3.16e-11,1,1)} from my q, my query working exactly how i want. 刚刚发现,如果我从我的q中删除{!boost b = recip(ms(NOW,date),3.16e-11,1,1)}},我的查询将按照我想要的方式正常工作。 But with this it don't 但是有了这个

update 2 更新2

Just figured out, that previously "just figured out" was completele wrong. 刚刚发现,以前“刚刚发现”是完全错误的。 I get it work for some search strings, but it don't work well for me. 我可以在某些搜索字符串中使用它,但对我来说效果不佳。 I think that i need this behaviour: 我认为我需要这种行为:

in "title" and "note" fields i need search words with "AND", but in "tags" field i need search with "OR". 在“标题”和“注释”字段中,我需要使用“ AND”搜索词,但是在“标签”字段中,我需要使用“ OR”搜索。 How can i do it with dismax? 我该如何使用dismax?

I try now with {!boost} and query functions, but without any good result 我现在尝试使用{!boost}和查询功能,但是没有任何好的结果

Your query looks like you copied from the web. 您的查询看起来就像您从网络上复制的一样。

1.) Make sure, that an field called "date" exists in your environment. 1.)确保您的环境中存在一个名为“日期”的字段。

2.) look at the solr output. 2.)查看solr输出。 If you are running solr inside tomcat, so look at the catalina.out... 如果您在Tomcat中运行solr,请查看catalina.out ...

...for number of hits and errors. ...点击次数和错误次数

How can i boost results for that records, where one of words match one of value from "tags" field? 如果单词之一与“标签”字段中的值之一匹配,我如何提高该记录的结果?

Look at the elevation component for that: http://wiki.apache.org/solr/QueryElevationComponent 查看高程组件: http : //wiki.apache.org/solr/QueryElevationComponent

You can use dismax's bq (boost query) to achieve this. 您可以使用dismax的bq (提升查询)来实现。 Read about bq here: http://wiki.apache.org/solr/DisMaxQParserPlugin#bq_.28Boost_Query.29 在此处阅读有关bq信息: http : bq

You'll have to break your query into individual words and search tags using each of those separately. 您必须将查询分解为单独的单词和使用每个单词的搜索标签。 So if your query is "abc pqr" you'll have: 因此,如果您的查询是“ abc pqr”,则将具有:

q={!boost b=recip(ms(NOW,date),3.16e-11,1,1)}%s&defType=dismax&qf=title^100 note&bq=tags:abc OR tags:pqr

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM