summaryrefslogtreecommitdiffstats
path: root/search
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2014-12-11 12:58:22 +0100
committerJörn Friedrich Dreyer <jfd@butonic.de>2015-01-02 10:28:41 +0100
commitc738359a111445aac90518db39b5d5883e44892d (patch)
tree7e12571398068d79f9df6c54ae651232d7cb7f87 /search
parent088323aad5de7b2fadd3c26a10cf4bdf51b5ae73 (diff)
downloadnextcloud-server-c738359a111445aac90518db39b5d5883e44892d.tar.gz
nextcloud-server-c738359a111445aac90518db39b5d5883e44892d.zip
add paged provider
Diffstat (limited to 'search')
-rw-r--r--search/ajax/search.php12
-rw-r--r--search/js/search.js10
2 files changed, 19 insertions, 3 deletions
diff --git a/search/ajax/search.php b/search/ajax/search.php
index 21e127e72b1..90771084659 100644
--- a/search/ajax/search.php
+++ b/search/ajax/search.php
@@ -38,8 +38,18 @@ if (isset($_GET['inApps'])) {
} else {
$inApps = array();
}
+if (isset($_GET['page'])) {
+ $page = (int)$_GET['page'];
+} else {
+ $page = 0;
+}
+if (isset($_GET['size'])) {
+ $size = (int)$_GET['size'];
+} else {
+ $size = 0;
+}
if($query) {
- $result = \OC::$server->getSearch()->search($query, $inApps);
+ $result = \OC::$server->getSearch()->search($query, $inApps, $page, $size);
OC_JSON::encodedPrint($result);
}
else {
diff --git a/search/js/search.js b/search/js/search.js
index 372d1d7a055..06a96fd582b 100644
--- a/search/js/search.js
+++ b/search/js/search.js
@@ -46,10 +46,16 @@
* Do a search query and display the results
* @param {string} query the search query
*/
- search: _.debounce(function(query) {
+ search: _.debounce(function(query, page, size) {
if(query) {
exports.addStyle('search','results');
- $.getJSON(exports.filePath('search','ajax','search.php')+'?query=' + encodeURIComponent(query), function(results) {
+ if (typeof page !== 'number') {
+ page = 0;
+ }
+ if (typeof size !== 'number') {
+ size = 30;
+ }
+ $.getJSON(OC.generateUrl('search/ajax/search.php'), {query:query, page:page, size:size }, function(results) {
exports.Search.lastResults = results;
exports.Search.showResults(results);
});