How to form a Solr edismax query with mutiple fields and different minimum match and boosts for different fields?

夙愿已清 提交于 2019-12-13 04:04:28

问题


I've a Solr index with all documents having three fields - name, address and other_addresses. I want to search for a person having name say 'Tom Cruise' and Address '3rd Avenue 23rd Floor New York, NY 10016'.

Now I want to search name in only name field having its some specific boost value and minimum match value as well. Also, address need to be searched in both address and other_addresses, with different mm and boost values.

Can someone help me in writing edismax query on any other way around for Solr?

I'm doing something like :

select?debugQuery=on&defType=edismax&fl=*%20score&mm=70%25&q=name%3A(Rita%20Suman%20Shinde%20Near)%20address%3A(Gunjan%20Talkies%20Yerwada%20Pune)%20other_addresses%3A(Gunjan%20Talkies%20Yerwada%20Pune)&qf=name%20other_addresses%20address&stopwords=true

but not able to figure how to give different mm values.


回答1:


You can use LocalParams to compose several dismax queries into one, and each of those subqueries can have its own dismax parameters. For example:

q={!dismax qf=name mm=2 v=$q1}^2.0 {!dismax qf=address1 mm=4 v=$q2}^1.5 {!dismax qf=other_address mm=4 v=$q2}^1.0
q1=Tom Cruise
q2=3rd Avenue 23rd Floor New York, NY 10016


来源:https://stackoverflow.com/questions/57766024/how-to-form-a-solr-edismax-query-with-mutiple-fields-and-different-minimum-match

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!