check if query term already has a trailing '*'

This commit is contained in:
Uwe Steinmann 2020-12-14 10:44:32 +01:00
parent 416568f1c4
commit e69f7125bc
2 changed files with 8 additions and 4 deletions

View File

@ -72,8 +72,10 @@ class SeedDMS_Lucene_Search {
*/
function search($term, $fields=array(), $limit=array()) { /* {{{ */
$querystr = '';
if($term)
$querystr .= trim($term);
$term = trim($term);
if($term) {
$querystr = substr($term, -1) != '*' ? $term.'*' : $term;
}
if(!empty($fields['owner'])) {
if(is_string($owner)) {
if($querystr)

View File

@ -72,8 +72,10 @@ class SeedDMS_SQliteFTS_Search {
*/
function search($term, $fields=array(), $limit=array()) { /* {{{ */
$querystr = '';
if($term)
$querystr .= trim($term);
$term = trim($term);
if($term) {
$querystr = substr($term, -1) != '*' ? $term.'*' : $term;
}
if(!empty($fields['owner'])) {
if(is_string($fields['owner'])) {
if($querystr)