简体   繁体   中英

Boost solr results with one word match from multiValued

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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