Archived
1
0

* Fix SQLite substring search to use % instead of * for secondary

matches (SvOlli)
This commit is contained in:
Garvin Hicking
2010-03-10 12:37:19 +00:00
parent 3a2694461e
commit a39785766c
2 changed files with 5 additions and 1 deletions
+2 -1
View File
@@ -773,6 +773,7 @@ function &serendipity_searchEntries($term, $limit = '', $searchresults = '') {
} elseif ($serendipity['dbType'] == 'sqlite' || $serendipity['dbType'] == 'sqlite3') {
// Very extensive SQLite search. There currently seems no other way to perform fulltext search in SQLite
// But it's better than no search at all :-D
$term = str_replace('*', '%', $term);
$cond['group'] = 'GROUP BY e.id';
$cond['distinct'] = '';
$term = serendipity_mb('strtolower', $term);
@@ -863,7 +864,7 @@ function &serendipity_searchEntries($term, $limit = '', $searchresults = '') {
//if * wasn't already appended and if there are none or not enough
//results, search again for entries containing the searchterm as a part
if (strpos($term, '*') === false) {
if (strpos($term, '*') === false && strpos($term, '%') === false) {
if (! is_array($search)) {
return serendipity_searchEntries($term.'*', $orig_limit);
}else if (count($search) < 4){