From 001037b821c5e628ae032139695a714fee058a52 Mon Sep 17 00:00:00 2001 From: Paul Pound Date: Mon, 20 Oct 2014 14:02:12 -0300 Subject: [PATCH] the bento solr searches now use the apachesolr modules fieldbiases --- .../solr_site/roblib_search_solr_site.module | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/targets/solr_site/roblib_search_solr_site.module b/targets/solr_site/roblib_search_solr_site.module index 5cf5175..6a19919 100755 --- a/targets/solr_site/roblib_search_solr_site.module +++ b/targets/solr_site/roblib_search_solr_site.module @@ -356,10 +356,31 @@ function roblib_search_solr_site_add_url($json) { function roblib_search_solr_site_get_results($query = NULL, $type) { $solr_url = variable_get('roblib_search_solr_site_url', 'http://localhost:8983/solr'); $num_results = variable_get('roblib_search_solr_site_num_results', '5'); + $defaults = array( + 'content' => '1.0', + 'ts_comments' => '0.5', + 'tos_content_extra' => '0.1', + 'label' => '5.0', + 'tos_name' => '3.0', + 'taxonomy_names' => '2.0', + 'tags_h1' => '5.0', + 'tags_h2_h3' => '3.0', + 'tags_h4_h5_h6' => '2.0', + 'tags_inline' => '1.0', + 'tags_a' => '0', + ); + $solr_qf = apachesolr_environment_variable_get(apachesolr_default_environment(), 'field_bias', $defaults); + $qf = ""; + foreach ($solr_qf as $key => $value){ + if($value != "0") { + $qf .= $key . '^' . $value . ' '; + } + } $data = array( 'q' => $query, 'fq' => $type, 'wt' => 'json', + 'qf' => $qf, 'rows' => $num_results, ); $url = url($solr_url . '/select', array('query' => $data));