开发者

Boost solr results with one word match from multiValued

开发者 https://www.devze.com 2023-03-14 08:34 出处:网络
I have solr schema with certain fields: <field name=\"id\" type=\"integer\" indexed=\"true\" stored=\"true\" required=\"true\" multiValued=\"false\" />

I have solr schema with certain fields:

<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)

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. But with this开发者_运维知识库 it don't

update 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". How can i do it with dismax?

I try now with {!boost} and query functions, but without any good result


Your query looks like you copied from the web.

1.) Make sure, that an field called "date" exists in your environment.

2.) look at the solr output. If you are running solr inside tomcat, so look at the 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


You can use dismax's bq (boost query) to achieve this. Read about bq here: http://wiki.apache.org/solr/DisMaxQParserPlugin#bq_.28Boost_Query.29

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:

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号