The user can select the min of chars to search, by default is 3
This commit is contained in:
parent
d37b7db041
commit
2517f0d181
1 changed files with 7 additions and 1 deletions
|
@ -10,6 +10,7 @@ class pluginSearch extends Plugin {
|
|||
// Fields and default values for the database of this plugin
|
||||
$this->dbFields = array(
|
||||
'label'=>'Search',
|
||||
'minChars'=>3,
|
||||
'wordsToCachePerPage'=>800,
|
||||
'showButtonSearch'=>false
|
||||
);
|
||||
|
@ -29,6 +30,11 @@ class pluginSearch extends Plugin {
|
|||
$html .= '<span class="tip">'.$L->get('This title is almost always used in the sidebar of the site').'</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Minimum number of characters when searching').'</label>';
|
||||
$html .= '<input name="minChars" type="text" value="'.$this->getValue('minChars').'">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Show button search').'</label>';
|
||||
$html .= '<select name="showButtonSearch">';
|
||||
|
@ -225,7 +231,7 @@ EOF;
|
|||
// Inlcude Fuzz algorithm
|
||||
require_once($this->phpPath().'vendors/fuzz.php');
|
||||
$fuzz = new Fuzz($cache, 10, 1, true);
|
||||
$results = $fuzz->search($text, 3);
|
||||
$results = $fuzz->search($text, $this->getValue('minChars'));
|
||||
|
||||
return(array_keys($results));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue