I currently have a SOLR query that uses query (q), query fields (qf) and phrase fields (pf) to get the results I want. Example:
/solr/select ?q=superbowl &qf=title^3+headline^2+intro+fulltext &pf=title^3+headline^2+intro+fulltext &fl=id,title,ts_modified,score &debugQuery=true
The idea is that the heading and heading of the โmain elementโ give the best idea of โโwhat the result is โabout,โ but the input and full text also give some data. Those. imagine a collection of links in which the collection itself has metadata (that it is a collection), but each link has its own data (link name, resume, etc.). If we search for "superbowl", the most relevant are the results with "superbowl" in the collection metadata, the least relevant are the results with "superbowl" in only one of the links ... but they are all valid results.
What I'm trying to do is add a boost to the relevance value so that the latest results pop up, but keep the title, title, input, full text as part of the formula. A recent search result in a collection metadata will be more relevant than one with it only in link metadata ... but this "only links" recent result may be more relevant than a very old result using a search string in a collection metadata. (I hope this is somewhat clear).
The problem is that I cannot figure out how to combine the boost function registered on the SOLR site using qf / pf fields. In particular...
From the SOLR site, something like the following works to increase results by date:
/solr/select ?q={!boost%20b=$dateboost%20v=$qq} &dateboost=ord(ts_modified) &qq=superbowl &fl=ts_modified,score &debugQuery=true
However, I cannot figure out how to combine this query using qf and pf. Any suggestions would be more than welcome.
Thanks to Danben's answer, I was able to come up with the following:
/solr/select ?q={!boost%20b=$dateboost%20v=$qq%20defType=dismax} &dateboost=ord(ts_modified) &qq=superbowl &qf=title^3+headline^2+intro^2+fulltext &pf=title^3+headline^2+intro^2+fulltext &fl=ts_modifieds,score &debugQuery=true
It seems that the actual issues I ran into were:
- I left spaces in the q parameter instead of running away from them (% 20) when copying / pasting
- In my q parameter, I did not include defType = dismax so that it would pay attention to the qf / pf parameters.