highlighted the FOUND X RESULTS sentence
This commit is contained in:
parent
9df43555ac
commit
5b26e36355
@ -763,43 +763,58 @@ function template_preprocess_materio_search_api_select_viewmode_block(&$vars){
|
||||
*
|
||||
* @see materio-search-api-results.tpl.php
|
||||
*/
|
||||
function template_preprocess_materio_search_api_results(array &$variables) {
|
||||
// dsm($variables, '$variables');
|
||||
$results = $variables['results'];
|
||||
$keys = $variables['keys'];
|
||||
function template_preprocess_materio_search_api_results(array &$vars) {
|
||||
// dsm($vars, '$vars');
|
||||
$results = $vars['results'];
|
||||
$keys = $vars['keys'];
|
||||
|
||||
// $variables['items'] = $variables['index']->loadItems(array_keys($variables['results']['results']));
|
||||
$variables['result_count'] = $results['result count'];
|
||||
$variables['sec'] = round($results['performance']['complete'], 3);
|
||||
// $vars['items'] = $vars['index']->loadItems(array_keys($vars['results']['results']));
|
||||
$vars['result_count'] = $results['result count'];
|
||||
$vars['sec'] = round($results['performance']['complete'], 3);
|
||||
|
||||
$vars['keywords'] = implode(', ', $vars['keys']);
|
||||
|
||||
if(isset($results['breves count'])){
|
||||
$variables['search_performance'] = format_plural(
|
||||
$vars['perfascard'] = true;
|
||||
$vars['search_performance'] = format_plural(
|
||||
$results['breves count'],
|
||||
'The search found 1 news ',
|
||||
'The search found @count news '
|
||||
);
|
||||
$variables['search_performance'] .= format_plural(
|
||||
$variables['result_count'] - $results['breves count'],
|
||||
$vars['search_performance'] .= format_plural(
|
||||
$vars['result_count'] - $results['breves count'],
|
||||
'with 1 associated matter.',
|
||||
'with @count associated matters.'
|
||||
);
|
||||
$variables['search_performance'] .= format_plural(
|
||||
$vars['search_performance'] .= format_plural(
|
||||
$results['could results']['result count'],
|
||||
' You could find 1 result with a ',
|
||||
' You could find <strong>@count results</strong> with a '
|
||||
);
|
||||
$variables['search_performance'] .= l(t('full access to materiO\'.'), 'node/11187');
|
||||
$vars['search_performance'] .= l(t('full access to materiO\'.'), 'node/11187');
|
||||
|
||||
$vars['search_performance'] .= l(t('pricing'), 'node/11187', array("attributes"=>array("class"=>array('button'))));
|
||||
|
||||
}else{
|
||||
$variables['search_performance'] = format_plural(
|
||||
// $results['result count'],
|
||||
$variables['result_count'],
|
||||
'The search found 1 result.',
|
||||
'The search found @count results.'
|
||||
$vars['perfascard'] = false;
|
||||
|
||||
// $vars['search_performance'] = format_plural(
|
||||
// // $results['result count'],
|
||||
// $vars['result_count'],
|
||||
// 'The search found 1 result ',
|
||||
// 'The search found @count results '
|
||||
// )
|
||||
|
||||
$vars['search_performance'] = t('The search found @count result(s) with keywords @keys. @mat materials and @new news.', array(
|
||||
"@count"=>$vars['result_count'],
|
||||
"@keys"=>$vars['keywords'],
|
||||
"@mat"=>4,
|
||||
"@new"=>7)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
//dsm($variables, 'variables');
|
||||
//dsm($vars, '$vars');
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,22 +2,22 @@
|
||||
|
||||
/**
|
||||
* materiobase_search_autocomplete_dbselect()
|
||||
*
|
||||
*
|
||||
* inspired by taxonomy_autocomplete()
|
||||
*
|
||||
*
|
||||
* OBSOLETE : this fonction use a direct dbselect request to provide results forautocomplete
|
||||
*
|
||||
*
|
||||
*/
|
||||
function materio_search_api_autocomplete_dbselect($typed = ''){
|
||||
// If the request has a '/' in the search text, then the menu system will have
|
||||
// split it into multiple arguments, recover the intended $tags_typed.
|
||||
$args = func_get_args();
|
||||
$typed = implode('/', $args);
|
||||
|
||||
|
||||
/*
|
||||
TODO riche serach engine + \\ etc gmail like
|
||||
*/
|
||||
|
||||
|
||||
if ($typed != '') {
|
||||
|
||||
// Part of the criteria for the query come from the field's own settings.
|
||||
@ -56,7 +56,7 @@ function materio_search_api_autocomplete_dbselect($typed = ''){
|
||||
|
||||
/**
|
||||
* materio_search_api_autocomplete_searchapi($typed = '')
|
||||
*
|
||||
*
|
||||
* GOOD one using searchapi (SOLR)
|
||||
*/
|
||||
function materio_search_api_autocomplete_searchapi($typed = ''){
|
||||
@ -64,7 +64,7 @@ function materio_search_api_autocomplete_searchapi($typed = ''){
|
||||
// split it into multiple arguments, recover the intended $tags_typed.
|
||||
$args = func_get_args();
|
||||
$typed = implode('/', $args);
|
||||
|
||||
|
||||
// dsm($typed, 'typed');
|
||||
if ($typed != '') {
|
||||
|
||||
@ -78,7 +78,7 @@ function materio_search_api_autocomplete_searchapi($typed = ''){
|
||||
global $language;
|
||||
$index_machine_name = variable_get('autocompletesearchindex_'.$language->language, -1);
|
||||
$query = search_api_query($index_machine_name);
|
||||
|
||||
|
||||
// $query_filter = $query->createFilter();
|
||||
// $query_filter->condition('name', $tosearch);
|
||||
// $query_filter->condition('type', 'article');
|
||||
@ -96,14 +96,14 @@ function materio_search_api_autocomplete_searchapi($typed = ''){
|
||||
//dsm($item, '$item');
|
||||
//$term_matches[$item->tid] = check_plain($item->name);
|
||||
// $term_matches[check_plain($item->name)] = check_plain($item->name);
|
||||
// TODO: leave tags with nodes
|
||||
// TODO: leave tags with nodes
|
||||
$term_matches[ trim(implode(' ', $adv_search_q[0]).' '.$last[1].$item->name)] = check_plain($item->name);
|
||||
|
||||
$delta++;
|
||||
if($delta > 15)
|
||||
break;
|
||||
}
|
||||
drupal_json_output($term_matches);
|
||||
}
|
||||
drupal_json_output($term_matches);
|
||||
}else{
|
||||
drupal_json_output(array());
|
||||
}
|
||||
@ -111,15 +111,15 @@ function materio_search_api_autocomplete_searchapi($typed = ''){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// dsm($term_matches, 'term_matches');
|
||||
// return 'debug mode of materio_search_api_autocomplete_searchapi';
|
||||
}
|
||||
|
||||
/**
|
||||
* materio_search_api_results_search()
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function materio_search_api_results_search(){
|
||||
global $user;
|
||||
@ -138,11 +138,11 @@ function materio_search_api_results_search(){
|
||||
// else{
|
||||
// $page = 0;
|
||||
// }
|
||||
|
||||
|
||||
preg_match_all('/\s?[^\s]+\s?/', $typed, $words);
|
||||
// dsm($words, "words");
|
||||
|
||||
|
||||
|
||||
// $match = array('\\', '+', '-', '&', '|', '!', '(', ')', '{', '}', '[', ']', '^', '~', '*', '?', ':', '"', ';', ' ');
|
||||
// $replace = array('\\\\', '\\+', '\\-', '\\&', '\\|', '\\!', '\\(', '\\)', '\\{', '\\}', '\\[', '\\]', '\\^', '\\~', '\\*', '\\?', '\\:', '\\"', '\\;', '\\ ');
|
||||
foreach ($words[0] as $word) {
|
||||
@ -197,7 +197,7 @@ function materio_search_api_results_search(){
|
||||
// dsm($viewmode, 'viewmode');
|
||||
|
||||
if ($keys) {
|
||||
// TODO: cache the results with cache graceful : http://drupal.org/project/cache_graceful
|
||||
// TODO: cache the results with cache graceful : http://drupal.org/project/cache_graceful
|
||||
try {
|
||||
$limit = variable_get($viewmode.'_limite', '10');
|
||||
$offset = pager_find_page() * $limit; //$page*$limit;//
|
||||
@ -244,7 +244,7 @@ function materio_search_api_results_search(){
|
||||
// $results['results'] = $accessible_results;
|
||||
// $results['result count'] = count($accessible_results);
|
||||
|
||||
|
||||
|
||||
|
||||
if(user_access('use materio search api')){
|
||||
$items = $index->loadItems(array_keys($results['results']));
|
||||
@ -296,7 +296,7 @@ function materio_search_api_results_search(){
|
||||
|
||||
if (!empty($results['ignored'])) {
|
||||
drupal_set_message(
|
||||
t('The following search keys are too short or too common and were therefore ignored: "@list".',
|
||||
t('The following search keys are too short or too common and were therefore ignored: "@list".',
|
||||
array( '@list' => implode(t('", "'), $results['ignored']) ) ),
|
||||
'warning'
|
||||
);
|
||||
@ -320,7 +320,7 @@ function materio_search_api_actuality(){
|
||||
global $user;
|
||||
|
||||
if(isset($user->roles[1])){
|
||||
$date_limit = strtotime('-6 month');
|
||||
$date_limit = strtotime('-6 month');
|
||||
// dsm(date('d m y', $date_limit));
|
||||
}
|
||||
|
||||
@ -361,7 +361,7 @@ function materio_search_api_actuality(){
|
||||
if(isset($result['node'])){
|
||||
foreach ($result['node'] as $nid => $n) {
|
||||
$breve = node_load($nid);
|
||||
|
||||
|
||||
if(!node_access('view', $breve))
|
||||
continue;
|
||||
|
||||
@ -377,7 +377,7 @@ function materio_search_api_actuality(){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// drupal_set_title(t('Actualities'));
|
||||
drupal_set_title(t(''));
|
||||
|
||||
|
@ -38,11 +38,21 @@
|
||||
<?php //if (!empty($result_count)) : ?>
|
||||
<div class="materiobase-results <?php print ' view-mode-' . $variables['view_mode'];?>">
|
||||
<?php if ($result_count) : ?>
|
||||
<p class="search-performance"><?php print render($search_performance); ?></p>
|
||||
<?php if(!$perfascard): ?>
|
||||
<p class="search-performance"><?php print render($search_performance); ?></P>
|
||||
<?php endif; ?>
|
||||
<?php //print render($spellcheck); ?>
|
||||
<div class="search-results">
|
||||
<?php if($perfascard): ?>
|
||||
<article class="search-performance <?php print ' view-mode-' . $variables['view_mode'];?>">
|
||||
<div class="inner">
|
||||
|
||||
<p><?php print render($search_performance); ?></P>
|
||||
</div>
|
||||
</article>
|
||||
<?php endif; ?>
|
||||
<?php //dsm($items, '$items'); ?>
|
||||
<?php
|
||||
<?php
|
||||
// TODO: use cache system to gain in speed, view http://drupal.org/node/930760
|
||||
?>
|
||||
<?php print render(entity_view($index->item_type, $items, $variables['view_mode'])); ?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user