|
@@ -131,7 +131,7 @@ function materio_search_api_results_search(){
|
|
|
$keys = func_get_args();
|
|
|
// dsm($args, 'args');
|
|
|
$typed = implode('/', $keys);
|
|
|
-
|
|
|
+
|
|
|
// remove query page params
|
|
|
preg_match_all('/\?page=([0-9]+)/', $typed, $pages);
|
|
|
//dsm($pages, '$pages');
|
|
@@ -228,7 +228,7 @@ function msa_solrquery_materiauxbreves($typed, $language, $user, $offset, $limit
|
|
|
# define search api solr index
|
|
|
$taxo_index_machine_name = variable_get('taxonomysearchindex_'.$language->language, -1);
|
|
|
$taxo_index = search_api_index_load($taxo_index_machine_name);
|
|
|
-
|
|
|
+
|
|
|
#create the solr query for taxonomy search
|
|
|
$taxo_query = search_api_query($taxo_index_machine_name, $query_options)
|
|
|
->keys($typed);
|
|
@@ -253,7 +253,7 @@ function msa_solrquery_materiauxbreves($typed, $language, $user, $offset, $limit
|
|
|
|
|
|
#add range to retriev the real current results
|
|
|
$taxo_query->range($offset, $limit);
|
|
|
-
|
|
|
+
|
|
|
# execute solr query and record results
|
|
|
$taxo_results = $taxo_query->execute();
|
|
|
// dsm($taxo_results, "taxo results");
|
|
@@ -272,7 +272,7 @@ function msa_solrquery_materiauxbreves($typed, $language, $user, $offset, $limit
|
|
|
$fulltxt_index_machine_name = variable_get('fulltextsearchindex_'.$language->language, -1);
|
|
|
$fulltxt_index = search_api_index_load($fulltxt_index_machine_name);
|
|
|
|
|
|
- #then calculate the good offset and limit for the complementary search
|
|
|
+ #then calculate the good offset and limit for the complementary search
|
|
|
$fulltxt_offset = $offset - $taxo_results['result count'];
|
|
|
|
|
|
#create the solr query for taxonomy search
|
|
@@ -296,10 +296,10 @@ function msa_solrquery_materiauxbreves($typed, $language, $user, $offset, $limit
|
|
|
$nid_filter->condition('nid', $nid, '<>');
|
|
|
|
|
|
$fulltxt_query->filter($nid_filter);
|
|
|
-
|
|
|
+
|
|
|
# add user access solr query option
|
|
|
$fulltxt_query->setOption('search_api_access_account', $user);
|
|
|
-
|
|
|
+
|
|
|
# execute solr query and record results
|
|
|
$fulltxt_results = $fulltxt_query->execute();
|
|
|
// dsm($fulltxt_results, "fulltxt_results");
|
|
@@ -320,7 +320,7 @@ function msa_solrquery_materiauxbreves($typed, $language, $user, $offset, $limit
|
|
|
}
|
|
|
|
|
|
function msa_solrquery_breves($typed, $language, $user, $offset, $limit){
|
|
|
-
|
|
|
+
|
|
|
$index_machine_name = variable_get('brevessearchindex_'.$language->language, -1);
|
|
|
// dsm($index_machine_name, '$index_machine_name');
|
|
|
$index = search_api_index_load($index_machine_name);
|
|
@@ -353,7 +353,7 @@ function msa_solrquery_breves($typed, $language, $user, $offset, $limit){
|
|
|
# in case of free user search, run a real search to indicate how much items you could find
|
|
|
$could_query = search_api_query($could_index_machine_name, array('conjunction'=>'OR', 'parse mode'=>'direct'))
|
|
|
->keys($typed);
|
|
|
-
|
|
|
+
|
|
|
$could_results = $could_query->execute();
|
|
|
// dsm($could_results, 'could_results');
|
|
|
$results['could results'] = $could_results;
|
|
@@ -383,10 +383,10 @@ function msa_solrquery_breves($typed, $language, $user, $offset, $limit){
|
|
|
$results['items'] = $items;
|
|
|
$results['breves count'] = $results['result count'];
|
|
|
$results['result count'] = count($items);
|
|
|
-
|
|
|
+
|
|
|
// dsm($results, "results");
|
|
|
# TODO: cache the results with cache graceful : http://drupal.org/project/cache_graceful
|
|
|
- return $results;
|
|
|
+ return $results;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -444,13 +444,15 @@ function materio_search_api_actuality(){
|
|
|
continue;
|
|
|
|
|
|
$items[] = $breve;
|
|
|
- $materiaux = field_get_items('node',$breve,'field_materiau_ref');
|
|
|
- // dsm($materiaux, 'materiaux');
|
|
|
- if($materiaux){
|
|
|
- foreach ($materiaux as $value) {
|
|
|
- $materiau = node_load($value['target_id']);
|
|
|
- if(node_access('view', $materiau))
|
|
|
- $items[] = $materiau;
|
|
|
+ if(user_access('access to materio database')){
|
|
|
+ $materiaux = field_get_items('node',$breve,'field_materiau_ref');
|
|
|
+ // dsm($materiaux, 'materiaux');
|
|
|
+ if($materiaux){
|
|
|
+ foreach ($materiaux as $value) {
|
|
|
+ $materiau = node_load($value['target_id']);
|
|
|
+ if(node_access('view', $materiau))
|
|
|
+ $items[] = $materiau;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|