bugfixe : autocomplete and guillemets

This commit is contained in:
Bachir Soussi Chiadmi 2014-09-10 21:04:02 +08:00
parent 982122065e
commit ef50154a49

View File

@ -71,7 +71,10 @@ function materio_search_api_autocomplete_searchapi($typed = ''){
// search for patterns like key -another key +lastkey // search for patterns like key -another key +lastkey
// and provide auto completion for the last key // and provide auto completion for the last key
preg_match_all('/\s?[\+|-]?[^\s]+/', $typed, $adv_search_q); preg_match_all('/\s?[\+|-]?[^\s]+/', $typed, $adv_search_q);
// dsm($adv_search_q, "adv_search_q");
preg_match('/^(\+|-)?(.*)$/', trim(array_pop($adv_search_q[0])), $last); preg_match('/^(\+|-)?(.*)$/', trim(array_pop($adv_search_q[0])), $last);
// dsm($last, "last");
$tosearch = isset($last[2]) ? $last[2] : $typed; $tosearch = isset($last[2]) ? $last[2] : $typed;
// build the query // build the query
@ -97,7 +100,7 @@ function materio_search_api_autocomplete_searchapi($typed = ''){
//$term_matches[$item->tid] = check_plain($item->name); //$term_matches[$item->tid] = check_plain($item->name);
// $term_matches[check_plain($item->name)] = 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); $term_matches[trim(implode(' ', $adv_search_q[0]).' "'.$last[1].$item->name).'"'] = check_plain($item->name);
$delta++; $delta++;
if($delta > 15) if($delta > 15)