基于实时日期、标题和关键字的Solr boost

基于实时日期、标题和关键字的Solr boost,solr,runtime,Solr,Runtime,我想根据live_日期、标题和关键字来提升内容 1) 我可以使用qf和pf提高标题和关键字: ?q=mySearchTerm&fl=id,title,live_date,content,score&sort=score desc&qf=title^2.0 keywords^1.2 content^1.0&pf=title^2.0 keywords^1.2 content^1.0 2) 我可以通过使用函数计算live_datetime来提升live_date到现在

我想根据live_日期、标题和关键字来提升内容

1) 我可以使用qf和pf提高标题和关键字:

?q=mySearchTerm&fl=id,title,live_date,content,score&sort=score desc&qf=title^2.0 keywords^1.2 content^1.0&pf=title^2.0 keywords^1.2 content^1.0
2) 我可以通过使用函数计算live_datetime来提升live_date到现在,并应用recip函数:

?q={!boost b=$recency v=$qq}&recency=recip(ms(NOW/HOUR,live_datetime),3.16e-11,0.08,0.05)&qq="mysearchTerm"&sort=score desc
3) 如何将1)和2)结合起来,以便同时提高live_日期+标题和关键字?我试过了,但失败了。有人能指出这个问题吗?谢谢

?q={!boost b=$recency v=$qq}&recency=recip(ms(NOW/HOUR,live_datetime),3.16e-11,0.08,0.05)
&qq="mysearchTerm"&qf=title^2.0 keywords^1.2 content^1.0&pf=title^2.0 keywords^1.2 content^1.0&fl=live_datetime,score

请给我一些建议。非常感谢。

为什么不使用如下的增强功能:

q=“mysearchTerm”&qf=title^2.0关键字^1.2内容^1.0&pf=title^2.0关键字^1.2内容^1.0&fl=live_datetime,score&bf=recip(毫秒(现在/小时,live_datetime),3.16e-11,0.08,0.05)^5

根据您所说的do work示例,我怀疑您在solrconfig.xml中为请求处理程序配置了“defType=dismax”或“defType=edismax”——这是示例1关注qf和pf参数的唯一原因

defType仅适用于解析当前上下文的主查询(即顶级请求中的“q”;子查询中的“v”),在示例#2和#3中,您使用localparam语法来覆盖该查询。为了确保您的“qq”参数是使用Demax/eDiscoveryMax解析的,您需要为正在解析qq的上下文指定defType作为本地参数

?q={!boost b=$recency defType=edismax v=$qq}&recency=recip(ms(NOW/HOUR,live_datetime),3.16e-11,0.08,0.05)&qq="mysearchTerm"&qf=title^2.0 keywords^1.2 content^1.0&pf=title^2.0 keywords^1.2 content^1.0&fl=live_datetime,score
...OR...
?q={!boost b=$recency defType=dismax v=$qq}&recency=recip(ms(NOW/HOUR,live_datetime),3.16e-11,0.08,0.05)&qq="mysearchTerm"&qf=title^2.0 keywords^1.2 content^1.0&pf=title^2.0 keywords^1.2 content^1.0&fl=live_datetime,score
或者,如果您使用的是edismax,那么您可以使用edismax解析器的“boost”参数,而不是使用“boost”QParser来包装“edismax”QParser,以更简单的语法完成相同的任务

?q="mysearchTerm"&boost=recip(ms(NOW/HOUR,live_datetime),3.16e-11,0.08,0.05)&qf=title^2.0 keywords^1.2 content^1.0&pf=title^2.0 keywords^1.2 content^1.0&fl=live_datetime,score

很好的建议,但看起来edismas只适用于solr3.1+,我们现在仍然使用solr1.4.1。但升级后我会使用你最后的建议。谢谢。杰夫:我发布的最初建议也适用于Demax(编辑以使其更加清晰)。。只有最后一个建议需要edismax.Cool,这对于defType=demax的solr1.4.1很好。我现在将实施这个想法。谢谢。
?q="mysearchTerm"&boost=recip(ms(NOW/HOUR,live_datetime),3.16e-11,0.08,0.05)&qf=title^2.0 keywords^1.2 content^1.0&pf=title^2.0 keywords^1.2 content^1.0&fl=live_datetime,score