Add a new config item to ignore a category in search. Simplify the queries. re #123

This commit is contained in:
Sébastien Lucas 2013-12-08 21:01:17 +01:00
parent 21f31d92aa
commit 7ba85d150b
3 changed files with 56 additions and 19 deletions

View file

@ -745,14 +745,13 @@ class PageQueryResult extends Page
}
$crit = "%" . $this->query . "%";
$bad = "QQQQQ";
// Special case when we are doing a search and no database is selected
if (is_array ($config['calibre_directory']) && is_null (GetUrlParam (DB))) {
$i = 0;
foreach ($config['calibre_directory'] as $key => $value) {
Base::clearDb ();
list ($array, $totalNumber) = Book::getBooksByQuery (array ($crit, $crit, $crit, $crit, $crit), 1, $i, 1);
list ($array, $totalNumber) = Book::getBooksByQuery (array ("all" => $crit), 1, $i, 1);
array_push ($this->entryArray, new Entry ($key, DB . ":query:{$i}",
str_format (localize ("bookword", $totalNumber), $totalNumber), "text",
array ( new LinkNavigation ("?" . DB . "={$i}&page=9&query=" . $this->query))));
@ -772,14 +771,14 @@ class PageQueryResult extends Page
break;
case self::SCOPE_BOOK :
list ($this->entryArray, $this->totalNumber) = Book::getBooksByQuery (
array ($bad, $bad, $bad, $bad, $crit), $this->n);
array ("book" => $crit), $this->n);
break;
case self::SCOPE_PUBLISHER :
$this->entryArray = Publisher::getAllPublishersByQuery ($this->query);
break;
default:
list ($this->entryArray, $this->totalNumber) = Book::getBooksByQuery (
array ($crit, $crit, $crit, $crit, $crit), $this->n);
array ("all" => $crit), $this->n);
}
}
}