summaryrefslogtreecommitdiffstats
path: root/lib/private/search.php
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2014-12-17 18:49:39 +0100
committerJörn Friedrich Dreyer <jfd@butonic.de>2015-01-02 10:28:41 +0100
commit606f802b7be0cb6f2f6d99c547e432bb8cd27994 (patch)
treec6e022168c4f1dc761e76ab8be78ba123c19f5f9 /lib/private/search.php
parent0e9b05b7012844e348d36b5b35e1c50487a3bbc4 (diff)
downloadnextcloud-server-606f802b7be0cb6f2f6d99c547e432bb8cd27994.tar.gz
nextcloud-server-606f802b7be0cb6f2f6d99c547e432bb8cd27994.zip
move search results below filelist, show hint when results are off screen, use js plugin mechanism
Diffstat (limited to 'lib/private/search.php')
-rw-r--r--lib/private/search.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/private/search.php b/lib/private/search.php
index 22f92534cbd..a29a4762b68 100644
--- a/lib/private/search.php
+++ b/lib/private/search.php
@@ -40,17 +40,19 @@ class Search implements ISearch {
* @return array An array of OC\Search\Result's
*/
public function search($query, array $inApps = array()) {
- return $this->searchPaged($query, $inApps, 0, 0);
+ // old apps might assume they get all results, so we set size 0
+ return $this->searchPaged($query, $inApps, 1, 0);
}
/**
* Search all providers for $query
* @param string $query
- * @param int $page
+ * @param string[] $inApps optionally limit results to the given apps
+ * @param int $page pages start at page 1
* @param int $size, 0 = all
* @return array An array of OC\Search\Result's
*/
- public function searchPaged($query, $page = 0, $size = 30) {
+ public function searchPaged($query, array $inApps = array(), $page = 1, $size = 30) {
$this->initProviders();
$results = array();
foreach($this->providers as $provider) {
@@ -63,7 +65,7 @@ class Search implements ISearch {
} else if ($provider instanceof Provider) {
$providerResults = $provider->search($query);
if ($size > 0) {
- $slicedResults = array_slice($providerResults, $page * $size, $size);
+ $slicedResults = array_slice($providerResults, ($page - 1) * $size, $size);
$results = array_merge($results, $slicedResults);
} else {
$results = array_merge($results, $providerResults);