aboutsummaryrefslogtreecommitdiffstats
path: root/lib
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
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')
-rw-r--r--lib/base.php1
-rw-r--r--lib/private/search.php10
-rw-r--r--lib/public/isearch.php5
-rw-r--r--lib/public/search/pagedprovider.php9
4 files changed, 14 insertions, 11 deletions
diff --git a/lib/base.php b/lib/base.php
index 551d0afbd78..34fa178ebf7 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -363,7 +363,6 @@ class OC {
OC_Util::addScript("config");
//OC_Util::addScript( "multiselect" );
OC_Util::addScript('search', 'search');
- OC_Util::addScript('search', 'result');
OC_Util::addScript("oc-requesttoken");
OC_Util::addScript("apps");
OC_Util::addVendorScript('snapjs/dist/latest/snap');
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);
diff --git a/lib/public/isearch.php b/lib/public/isearch.php
index 84e450afe6f..fe58f202d66 100644
--- a/lib/public/isearch.php
+++ b/lib/public/isearch.php
@@ -41,11 +41,12 @@ interface ISearch {
/**
* 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
* @return array An array of OCP\Search\Result's
*/
- public function searchPaged($query, $page = 0, $size = 30);
+ public function searchPaged($query, array $inApps = array(), $page = 1, $size = 30);
/**
* Register a new search provider to search with
diff --git a/lib/public/search/pagedprovider.php b/lib/public/search/pagedprovider.php
index 97da1dd2c85..10c36cfc483 100644
--- a/lib/public/search/pagedprovider.php
+++ b/lib/public/search/pagedprovider.php
@@ -44,15 +44,16 @@ abstract class PagedProvider extends Provider {
* @return array An array of OCP\Search\Result's
*/
public function search($query) {
- $this->searchPaged($query, 0, 0);
+ // old apps might assume they get all results, so we set size 0
+ $this->searchPaged($query, 1, 0);
}
/**
* Search for $query
* @param string $query
- * @param int $limit, 0 = unlimited
- * @param int $offset
+ * @param int $page pages start at page 1
+ * @param int $size, 0 = all
* @return array An array of OCP\Search\Result's
*/
- abstract public function searchPaged($query, $limit, $offset);
+ abstract public function searchPaged($query, $page, $size);
}