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) {
|
if ($search) {
|
||||||
$out = array ();
|
$out = array ();
|
||||||
$pagequery = Base::PAGE_OPENSEARCH_QUERY;
|
$pagequery = Base::PAGE_OPENSEARCH_QUERY;
|
||||||
|
$dbArray = array ("");
|
||||||
|
$d = $database;
|
||||||
// Special case when no databases were chosen, we search on all databases
|
// Special case when no databases were chosen, we search on all databases
|
||||||
if (Base::noDatabaseSelected ()) {
|
if (Base::noDatabaseSelected ()) {
|
||||||
$i = 0;
|
$dbArray = Base::getDbNameList ();
|
||||||
foreach (Base::getDbNameList () as $key) {
|
$d = 0;
|
||||||
Base::clearDb ();
|
}
|
||||||
|
foreach ($dbArray as $key) {
|
||||||
|
if (Base::noDatabaseSelected ()) {
|
||||||
array_push ($out, array ("title" => $key,
|
array_push ($out, array ("title" => $key,
|
||||||
"class" => "tt-header",
|
"class" => "tt-header",
|
||||||
"navlink" => "index.php?db={$i}"));
|
"navlink" => "index.php?db={$d}"));
|
||||||
list ($array, $total) = Book::getBooksByStartingLetter ('%' . $query, 1, $i, 5);
|
Base::getDb ($d);
|
||||||
array_push ($out, array ("title" => str_format (localize("bookword", $total), $total),
|
|
||||||
"class" => "",
|
|
||||||
"navlink" => "index.php?page={$pagequery}&query={$query}&db={$i}&scope=book"));
|
|
||||||
$i++;
|
|
||||||
}
|
}
|
||||||
return $out;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (array (PageQueryResult::SCOPE_BOOK,
|
foreach (array (PageQueryResult::SCOPE_BOOK,
|
||||||
PageQueryResult::SCOPE_AUTHOR,
|
PageQueryResult::SCOPE_AUTHOR,
|
||||||
PageQueryResult::SCOPE_SERIES,
|
PageQueryResult::SCOPE_SERIES,
|
||||||
|
@ -734,9 +730,10 @@ function getJson ($complete = false) {
|
||||||
// str_format (localize("tagword", count($array))
|
// str_format (localize("tagword", count($array))
|
||||||
// str_format (localize("publisherword", count($array))
|
// str_format (localize("publisherword", count($array))
|
||||||
array_push ($out, array ("title" => str_format (localize("{$key}word", $total), $total),
|
array_push ($out, array ("title" => str_format (localize("{$key}word", $total), $total),
|
||||||
"class" => "tt-header",
|
"class" => Base::noDatabaseSelected () ? "" : "tt-header",
|
||||||
"navlink" => "index.php?page={$pagequery}&query={$query}&db={$database}&scope={$key}"));
|
"navlink" => "index.php?page={$pagequery}&query={$query}&db={$d}&scope={$key}"));
|
||||||
}
|
}
|
||||||
|
if (!Base::noDatabaseSelected ()) {
|
||||||
foreach ($array as $entry) {
|
foreach ($array as $entry) {
|
||||||
if ($entry instanceof EntryBook) {
|
if ($entry instanceof EntryBook) {
|
||||||
array_push ($out, array ("class" => "", "title" => $entry->title, "navlink" => $entry->book->getDetailUrl ()));
|
array_push ($out, array ("class" => "", "title" => $entry->title, "navlink" => $entry->book->getDetailUrl ()));
|
||||||
|
@ -747,6 +744,12 @@ function getJson ($complete = false) {
|
||||||
if ($i > 4) { break; };
|
if ($i > 4) { break; };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
$d++;
|
||||||
|
if (Base::noDatabaseSelected ()) {
|
||||||
|
Base::clearDb ();
|
||||||
|
}
|
||||||
|
}
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue