浏览代码

pass offset value (string)

kaori 5 年之前
父节点
当前提交
a7434d3cff
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      src/server/service/bolt.js

+ 5 - 4
src/server/service/bolt.js

@@ -168,12 +168,11 @@ class BoltService {
     const { searchService } = this.crowi;
     const ApiPaginate = require('../util/apiPaginate');
 
-    const offset = 0;
+    const offset = this.state.pagenationOffset;
 
     const options = { limit: 10, offset };
 
     const paginateOpts = ApiPaginate.parseOptionsForElasticSearch(options);
-    console.log('paginateOpts', paginateOpts);
 
     const results = await searchService.searchKeyword(keywords, null, {}, paginateOpts);
 
@@ -210,11 +209,12 @@ class BoltService {
       return data._source.path;
     });
 
-    return resultPaths;
+    return { resultPaths, offset };
   }
 
   async showEphemeralSearchResults(command, args) {
-    const resultPaths = await this.getSearchResultPaths(command, args);
+    const { resultPaths, offset } = await this.getSearchResultPaths(command, args);
+
     const base = this.crowi.appService.getSiteUrl();
 
     const urls = resultPaths.map((path) => {
@@ -258,6 +258,7 @@ class BoltService {
                   text: 'Next',
                 },
                 action_id: 'showNextResults',
+                value: `${offset}`,
               },
               {
                 type: 'button',