]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add the missing cursor parameter to unified search requests
authorChristoph Wurst <christoph@winzerhof-wurst.at>
Tue, 25 Aug 2020 15:01:10 +0000 (17:01 +0200)
committerJoas Schilling <coding@schilljs.com>
Wed, 26 Aug 2020 07:45:21 +0000 (09:45 +0200)
Otherwise paginated search does not work. Basically you always requested
the first x items and then showed them again and again. The second or
any other subsequent page was never requested.

On a side note this also caused lots of Vue warning due to duplicate
keys.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
core/src/services/UnifiedSearchService.js
core/src/views/UnifiedSearch.vue

index 8e4c4a2a0731b516e819e82acd53d6d0ccf0a148..937fec667232ec640e3d68d6c3cd2a25950fc09b 100644 (file)
@@ -53,8 +53,13 @@ export async function getTypes() {
  *
  * @param {string} type the type to search
  * @param {string} query the search
+ * @param {int|string|undefined} cursor the offset for paginated searches
  * @returns {Promise}
  */
-export function search(type, query) {
-       return axios.get(generateUrl(`/search/providers/${type}/search?term=${query}`))
+export function search(type, query, cursor) {
+       return axios.get(generateUrl(`/search/providers/${type}/search?term=${query}`), {
+               params: {
+                       cursor,
+               }
+       })
 }
index 4f316866862c93f02abdbce1da356ea93144961b..56cb12d3dc76d2f27a59a98f6ac6770b7380966a 100644 (file)
@@ -338,7 +338,7 @@ export default {
                        this.$set(this.loading, type, true)
 
                        if (this.cursors[type]) {
-                               const request = await search(type, this.query)
+                               const request = await search(type, this.query, this.cursors[type])
 
                                // Save cursor if any
                                if (request.data.cursor) {