🔥 移除简单搜索

- 关闭搜索接口验证
This commit is contained in:
Suwen 2021-03-06 12:22:00 +08:00
parent 5fee803eec
commit d8b30d7af9
5 changed files with 1 additions and 96 deletions

View File

@ -71,7 +71,7 @@ public class WebMvcConfigurer extends WebMvcConfigurationSupport {
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(restAuthTokenInterceptor()).addPathPatterns("/api/**")
.excludePathPatterns("/api/v1/console/**", "/api/v1/article/articles/**", "/api/v1/article/detail/**"
, "/api/v1/topic/**", "/api/v1/user/**", "/api/v1/article/*/comments", "/api/v1/rule/currency/**");
, "/api/v1/topic/**", "/api/v1/user/**", "/api/v1/article/*/comments", "/api/v1/rule/currency/**", "/api/v1/lucene/**");
}

View File

@ -1,28 +0,0 @@
package com.rymcu.forest.mapper;
import com.rymcu.forest.dto.SearchModel;
import java.util.List;
/**
* @author ronger
*/
public interface SearchMapper {
/**
* 初始化文章搜索数据
* @return
*/
List<SearchModel> searchInitialArticleSearch();
/**
* 初始化作品集搜索数据
* @return
*/
List<SearchModel> searchInitialPortfolioSearch();
/**
* 初始化用户搜索数据
* @return
*/
List<SearchModel> searchInitialUserSearch();
}

View File

@ -1,16 +0,0 @@
package com.rymcu.forest.service;
import com.rymcu.forest.dto.SearchModel;
import java.util.List;
/**
* @author ronger
*/
public interface SearchService {
/**
* 初始化搜索数据
* @return
*/
List<SearchModel> initialSearch();
}

View File

@ -1,43 +0,0 @@
package com.rymcu.forest.service.impl;
import com.rymcu.forest.core.service.redis.RedisResult;
import com.rymcu.forest.core.service.redis.RedisService;
import com.rymcu.forest.dto.SearchModel;
import com.rymcu.forest.mapper.SearchMapper;
import com.rymcu.forest.service.SearchService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* @author ronger
*/
@Service
public class SearchServiceImpl implements SearchService {
@Resource
private SearchMapper searchMapper;
@Resource
private RedisService redisService;
@Override
public List<SearchModel> initialSearch() {
String searchKey = "initialSearch";
RedisResult<SearchModel> result = redisService.getListResult(searchKey, SearchModel.class);
if (Objects.nonNull(result.getListResult())) {
return result.getListResult();
}
List<SearchModel> list = new ArrayList<>();
List<SearchModel> articleSearchModels = searchMapper.searchInitialArticleSearch();
List<SearchModel> portfolioSearchModels = searchMapper.searchInitialPortfolioSearch();
List<SearchModel> userSearchModels = searchMapper.searchInitialUserSearch();
list.addAll(articleSearchModels);
list.addAll(portfolioSearchModels);
list.addAll(userSearchModels);
redisService.set(searchKey, list, 24 * 60 * 60);
return list;
}
}

View File

@ -34,8 +34,6 @@ public class CommonApiController {
private ArticleService articleService;
@Resource
private PortfolioService portfolioService;
@Resource
private SearchService SearchService;
@GetMapping("/get-email-code")
public GlobalResult<Map<String, String>> getEmailCode(@RequestParam("email") String email) throws MessagingException {
@ -134,10 +132,4 @@ public class CommonApiController {
Map map = Utils.getArticlesGlobalResult(pageInfo);
return GlobalResultGenerator.genSuccessResult(map);
}
@GetMapping("/initial-search")
public GlobalResult initialSearch() {
List<SearchModel> list = SearchService.initialSearch();
return GlobalResultGenerator.genSuccessResult(list);
}
}