Yuki Takei 6 лет назад
Родитель
Сommit
bf17814783

+ 1 - 5
src/client/js/components/Admin/FullTextSearchManagement/RebuildIndex.jsx

@@ -48,13 +48,9 @@ class RebuildIndex extends React.Component {
   async buildIndex() {
 
     const { appContainer } = this.props;
-    const pageId = this.pageId;
 
     try {
-      const res = await appContainer.apiPost('/admin/search/build', { page_id: pageId });
-      if (!res.ok) {
-        throw new Error(res.message);
-      }
+      await appContainer.apiv3Put('/search/indices', { operation: 'rebuild' });
 
       this.setState({ isProcessing: true });
       toastSuccess('Rebuilding is requested');

+ 0 - 17
src/server/routes/admin.js

@@ -994,23 +994,6 @@ module.exports = function(crowi, app) {
     }
   };
 
-
-  actions.api.searchBuildIndex = async function(req, res) {
-    const search = crowi.getSearcher();
-    if (!search) {
-      return res.json(ApiResponse.error('ElasticSearch Integration is not set up.'));
-    }
-
-    try {
-      search.buildIndex();
-    }
-    catch (err) {
-      return res.json(ApiResponse.error(err));
-    }
-
-    return res.json(ApiResponse.success());
-  };
-
   /**
    * validate setting form values for SAML
    *

+ 0 - 1
src/server/routes/index.js

@@ -93,7 +93,6 @@ module.exports = function(crowi, app) {
 
   // search admin
   app.get('/admin/search'              , loginRequiredStrictly , adminRequired , admin.search.index);
-  app.post('/_api/admin/search/build'  , loginRequiredStrictly , adminRequired , csrf, admin.api.searchBuildIndex);
 
   // notification admin
   app.get('/admin/notification'              , loginRequiredStrictly , adminRequired , admin.notification.index);