{"id":4417,"date":"2016-06-13T02:03:50","date_gmt":"2016-06-13T02:03:50","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=4417"},"modified":"2016-06-13T02:03:50","modified_gmt":"2016-06-13T02:03:50","slug":"solr-bf-vs-bq","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/solr-bf-vs-bq\/","title":{"rendered":"Solr: bf vs bq"},"content":{"rendered":"<p>The &#8220;bf&#8221; and &#8220;bq&#8221; URL parameters are arguments to the dismax and edismax parsers in Solr. <\/p>\n<p>&#8220;bf&#8221; stands for &#8220;boost function&#8221;, and &#8220;bq&#8221; is &#8220;boost query&#8221;. These are useful because unlike &#8220;boost&#8221; they are additive (boost does multiplication).<\/p>\n<p>&#8220;Boost field&#8221; adds the output of a field to the score. <\/p>\n<p>However, this is a little more confusing than it first appears. Here, I&#8217;ve done &#8220;bf=add(talk_day_i, 5)&#8221;, just to show how two forms of addition can be combined.<\/p>\n<p>The output of &#8220;bf&#8221; is being treated like a vector and normalized in some way, so it&#8217;s not as if you&#8217;re adding a specific value to the final score:<\/p>\n<pre>\n26.16295 = sum of:\n  0.70710677 = *:*, product of:\n    1.0 = boost\n    0.70710677 = queryNorm\n  25.455843 = FunctionQuery(sum(int(talk_day_i),const(5))), product of:\n    36.0 = sum(int(talk_day_i)=31,const(5))\n    0.70710677 = boost\n    1.0 = queryNorm\n\",\n<\/pre>\n<p>Just to fully understand this, lets then do this with &#8220;bq&#8221;:<\/p>\n<pre lang\">\nbq=category_l2_ss:history\n<\/pre>\n<p>Here, we don&#8217;t see any additional values in the debug ouput for each row, because the score is already computed using the &#8220;boost&#8221; we&#8217;ve applied, but you can see that it is handled outside of the work that runs on each row.<\/p>\n<pre>\n\"parsedquery\": \"(+MatchAllDocsQuery(*:*) category_l2_ss:history)\/no_coord\",\n\"parsedquery_toString\": \"+*:* category_l2_ss:history\",\n\"explain\": {\n  \"cc7096a2-8e08-4e86-a738-c96d73f0979c\": \"\n     0.114599384 = sum of:\n       0.114599384 = *:*, product of:\n         1.0 = boost\n           0.114599384 = queryNorm\n  \",\n  ... \n},\n\"QParser\": \"ExtendedDismaxQParser\",\n\"altquerystring\": null,\n\"boost_queries\": [\n  \"category_l2_ss:history\"\n],\n\"parsed_boost_queries\": [\n  \"category_l2_ss:history\"\n],\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Understanding bf, bq, and boost in the Solr edismax\/dismax parsers<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[11],"tags":[517],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/4417"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=4417"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/4417\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=4417"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=4417"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=4417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}