From 89e8c49ae5340570828a48b15fbec91a1ad52b5c Mon Sep 17 00:00:00 2001 From: Paul Pound Date: Thu, 24 Jul 2014 09:16:53 -0300 Subject: [PATCH] updated bestbet target so query is wrapped in quotes --- targets/solr_site/roblib_search_solr_site.module | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/targets/solr_site/roblib_search_solr_site.module b/targets/solr_site/roblib_search_solr_site.module index 54149e7..e68c3af 100755 --- a/targets/solr_site/roblib_search_solr_site.module +++ b/targets/solr_site/roblib_search_solr_site.module @@ -162,6 +162,14 @@ function roblib_search_solr_site_block_info() { return $blocks; } +/** + * Add a div around our block content so we can theme our panels. + * + * By adding our divs we can theme ours without affecting other drupal panels. + * + * @param $variables + * @param $hook + */ function roblib_search_solr_site_preprocess_panels_pane(&$variables, $hook){ switch ($variables['pane']->subtype) { case 'roblib_search_solr_site-roblib_search_solr_site_bestbet': @@ -217,7 +225,11 @@ function roblib_search_solr_site_results($query) { } function roblib_search_solr_site_bestbet($query) { - $json = roblib_search_solr_site_get_results("sort_label:$query", 'bundle:bestbet'); + // Bestbet is a very strict search with an exact match on node title only. + // We have to surround the search with quotes but we don't want double quotes. + // If they have quotes anywhere else in the string we shouldn't get a match anyway. + $query = str_replace('"', '', $query); + $json = roblib_search_solr_site_get_results("sort_label:\"$query\"", 'bundle:bestbet'); $json = roblib_search_solr_site_add_url($json); print $json; exit();