* 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 9188830786
commit 1125523eca
2 changed files with 5 additions and 1 deletions

View File

@ -3,6 +3,9 @@
Version 1.6 ()
------------------------------------------------------------------------
* Fix SQLite substring search to use % instead of * for secondary
matches (SvOlli)
* Recent entries plugin can now fetch the associated categoryid,
when a single entry is displayed. (Garvinhicking)

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){