Series can now be searched with normalized search. re #48, #49

This commit is contained in:
Sébastien Lucas 2014-05-12 22:15:51 +02:00
parent 789fc5468e
commit d9bdd2b136
3 changed files with 6 additions and 5 deletions

View file

@ -74,13 +74,13 @@ order by series.sort');
} }
public static function getAllSeriesByQuery($query) { public static function getAllSeriesByQuery($query) {
$result = parent::getDb ()->prepare('select series.id as id, series.name as name, series.sort as sort, count(*) as count $columns = "series.id as id, series.name as name, series.sort as sort, count(*) as count";
from series, books_series_link $sql = 'select {0} from series, books_series_link
where series.id = series and series.name like ? where series.id = series and upper (series.name) like ?
group by series.id, series.name, series.sort group by series.id, series.name, series.sort
order by series.sort'); order by series.sort';
list ($totalNumber, $result) = parent::executeQuery ($sql, $columns, "", array ('%' . $query . '%'), -1);
$entryArray = array(); $entryArray = array();
$result->execute (array ('%' . $query . '%'));
while ($post = $result->fetchObject ()) while ($post = $result->fetchObject ())
{ {
$serie = new Serie ($post->id, $post->sort); $serie = new Serie ($post->id, $post->sort);

Binary file not shown.

View file

@ -714,6 +714,7 @@ class PageTest extends PHPUnit_Framework_TestCase
array ("émile zola", 1, "1 author"), array ("émile zola", 1, "1 author"),
array ("Litterature", 1, "1 tag"), array ("Litterature", 1, "1 tag"),
array ("Litterâture", 1, "1 tag"), array ("Litterâture", 1, "1 tag"),
array ("Serie des Rougon", 1, "1 series"),
array ("Eugene Fasquelle", 1, "1 publisher") array ("Eugene Fasquelle", 1, "1 publisher")
); );
} }