Explorar el Código

for simple users, search find news and related materiaux only if these materiaux also match with the search

Bachir Soussi Chiadmi hace 11 años
padre
commit
051455cd71
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      materio_search_api.pages.inc

+ 3 - 1
materio_search_api.pages.inc

@@ -139,7 +139,6 @@ function materio_search_api_results_search(){
   //   $page = 0;
   // }
   
-
   preg_match_all('/\s?[^\s]+\s?/', $typed, $words);
   // dsm($words, "words");
 
@@ -227,6 +226,7 @@ function materio_search_api_results_search(){
         // ->filter($filter);
 
         $could_results = $could_query->execute();
+        // dsm($could_results, 'could_results');
       }
     }
     catch (SearchApiException $e) {
@@ -263,6 +263,8 @@ function materio_search_api_results_search(){
         // dsm($materiaux, 'materiaux');
         if($materiaux){
           foreach ($materiaux as $value) {
+            if(!isset($could_results['results'][$value['target_id']]))
+              continue;
             $materiau = node_load($value['target_id']);
             if(node_access('view', $materiau))
               $items[] = $materiau;