|
@@ -177,8 +177,19 @@ function materio_search_api_results_search(){
|
|
// TODO: this two following functions calls should be merged, it's not clean as it is
|
|
// TODO: this two following functions calls should be merged, it's not clean as it is
|
|
if(!$filters_search){
|
|
if(!$filters_search){
|
|
$results = msa_solrquery_materiauxbreves($typed, $language, $user, $offset, $limit);
|
|
$results = msa_solrquery_materiauxbreves($typed, $language, $user, $offset, $limit);
|
|
|
|
+ $human_readable_keywords = $typed;
|
|
}else{
|
|
}else{
|
|
- $results = msa_solrquery_filterssearch($typed, $language, $user, $offset, $limit);
|
|
|
|
|
|
+ // $keys = explode("+", $typed);
|
|
|
|
+ // foreach ($keys as $value) {
|
|
|
|
+ // $tids[] = intval($value);
|
|
|
|
+ // }
|
|
|
|
+ $tids = array_map('intval', explode('+', $typed));
|
|
|
|
+ $results = msa_solrquery_filterssearch($tids, $language, $user, $offset, $limit);
|
|
|
|
+
|
|
|
|
+ foreach ($tids as $tid) {
|
|
|
|
+ $tnames[] = taxonomy_term_load($tid)->name;
|
|
|
|
+ }
|
|
|
|
+ $human_readable_keywords = implode(" + ", $tnames);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
# only breves search (+ related materials)
|
|
# only breves search (+ related materials)
|
|
@@ -193,12 +204,11 @@ function materio_search_api_results_search(){
|
|
$ret['results']['#items'] = $results['items'];
|
|
$ret['results']['#items'] = $results['items'];
|
|
// $ret['results']['#index'] = $results['index'];
|
|
// $ret['results']['#index'] = $results['index'];
|
|
$ret['results']['#theme'] = 'materio_search_api_results';
|
|
$ret['results']['#theme'] = 'materio_search_api_results';
|
|
- $ret['results']['#keys'] = $typed;
|
|
|
|
|
|
+ $ret['results']['#keys'] = $human_readable_keywords;
|
|
$ret['results']['#view_mode'] = $viewmode;
|
|
$ret['results']['#view_mode'] = $viewmode;
|
|
|
|
|
|
// page title
|
|
// page title
|
|
- $page_title = $typed;
|
|
|
|
- drupal_set_title('<i class="icon-materio-search"></i>'.check_plain($page_title), PASS_THROUGH);
|
|
|
|
|
|
+ drupal_set_title('<i class="icon-materio-search"></i>'.check_plain($human_readable_keywords), PASS_THROUGH);
|
|
|
|
|
|
// render results
|
|
// render results
|
|
if(isset($results)){
|
|
if(isset($results)){
|
|
@@ -347,12 +357,7 @@ function msa_solrquery_materiauxbreves($keys, $language, $user, $offset, $limit)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-function msa_solrquery_filterssearch($keys, $language, $user, $offset, $limit){
|
|
|
|
- // dsm($keys, "keys");
|
|
|
|
- $keys = explode("+", $keys);
|
|
|
|
- foreach ($keys as $value) {
|
|
|
|
- $tids[] = intval($value);
|
|
|
|
- }
|
|
|
|
|
|
+function msa_solrquery_filterssearch($tids, $language, $user, $offset, $limit){
|
|
// dsm($tids, "tids");
|
|
// dsm($tids, "tids");
|
|
// dsm($offset, 'offset');
|
|
// dsm($offset, 'offset');
|
|
// dsm($limit, 'limit');
|
|
// dsm($limit, 'limit');
|
|
@@ -457,8 +462,6 @@ function msa_solrquery_filterssearch($keys, $language, $user, $offset, $limit){
|
|
}
|
|
}
|
|
|
|
|
|
function msa_cmp_filtered_results($a, $b){
|
|
function msa_cmp_filtered_results($a, $b){
|
|
- // dsm($a, "a");
|
|
|
|
- // dsm($b, "b");
|
|
|
|
if ($a['score'] == $b['score']) {
|
|
if ($a['score'] == $b['score']) {
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|