The multidatabase search is now the same as the normal autocomplete search. re #34
This commit is contained in:
parent
73277af6f4
commit
6cc0d5b1bc
33
book.php
33
book.php
|
@ -675,24 +675,20 @@ function getJson ($complete = false) {
|
|||
if ($search) {
|
||||
$out = array ();
|
||||
$pagequery = Base::PAGE_OPENSEARCH_QUERY;
|
||||
|
||||
$dbArray = array ("");
|
||||
$d = $database;
|
||||
// Special case when no databases were chosen, we search on all databases
|
||||
if (Base::noDatabaseSelected ()) {
|
||||
$i = 0;
|
||||
foreach (Base::getDbNameList () as $key) {
|
||||
Base::clearDb ();
|
||||
$dbArray = Base::getDbNameList ();
|
||||
$d = 0;
|
||||
}
|
||||
foreach ($dbArray as $key) {
|
||||
if (Base::noDatabaseSelected ()) {
|
||||
array_push ($out, array ("title" => $key,
|
||||
"class" => "tt-header",
|
||||
"navlink" => "index.php?db={$i}"));
|
||||
list ($array, $total) = Book::getBooksByStartingLetter ('%' . $query, 1, $i, 5);
|
||||
array_push ($out, array ("title" => str_format (localize("bookword", $total), $total),
|
||||
"class" => "",
|
||||
"navlink" => "index.php?page={$pagequery}&query={$query}&db={$i}&scope=book"));
|
||||
$i++;
|
||||
"navlink" => "index.php?db={$d}"));
|
||||
Base::getDb ($d);
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
foreach (array (PageQueryResult::SCOPE_BOOK,
|
||||
PageQueryResult::SCOPE_AUTHOR,
|
||||
PageQueryResult::SCOPE_SERIES,
|
||||
|
@ -734,9 +730,10 @@ function getJson ($complete = false) {
|
|||
// str_format (localize("tagword", count($array))
|
||||
// str_format (localize("publisherword", count($array))
|
||||
array_push ($out, array ("title" => str_format (localize("{$key}word", $total), $total),
|
||||
"class" => "tt-header",
|
||||
"navlink" => "index.php?page={$pagequery}&query={$query}&db={$database}&scope={$key}"));
|
||||
"class" => Base::noDatabaseSelected () ? "" : "tt-header",
|
||||
"navlink" => "index.php?page={$pagequery}&query={$query}&db={$d}&scope={$key}"));
|
||||
}
|
||||
if (!Base::noDatabaseSelected ()) {
|
||||
foreach ($array as $entry) {
|
||||
if ($entry instanceof EntryBook) {
|
||||
array_push ($out, array ("class" => "", "title" => $entry->title, "navlink" => $entry->book->getDetailUrl ()));
|
||||
|
@ -747,6 +744,12 @@ function getJson ($complete = false) {
|
|||
if ($i > 4) { break; };
|
||||
}
|
||||
}
|
||||
}
|
||||
$d++;
|
||||
if (Base::noDatabaseSelected ()) {
|
||||
Base::clearDb ();
|
||||
}
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue