diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 0d5519e..5090716 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -27,6 +27,7 @@
+
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
index b80d928..becad6c 100755
--- a/.idea/encodings.xml
+++ b/.idea/encodings.xml
@@ -37,6 +37,8 @@
+
+
diff --git a/han-note-search/pom.xml b/han-note-search/pom.xml
new file mode 100644
index 0000000..70aec9b
--- /dev/null
+++ b/han-note-search/pom.xml
@@ -0,0 +1,73 @@
+
+ 4.0.0
+
+
+ com.hanserwei
+ han-note
+ ${revision}
+
+
+
+ jar
+ han-note-search
+ ${project.artifactId}
+ 搜索服务
+
+
+
+ com.hanserwei
+ hanserwei-common
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+ com.hanserwei
+ hanserwei-spring-boot-starter-biz-operationlog
+
+
+
+
+ com.hanserwei
+ hanserwei-spring-boot-starter-jackson
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-bootstrap
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-discovery
+
+
+
+
+ co.elastic.clients
+ elasticsearch-java
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/han-note-search/src/main/java/com/hanserwei/hannote/search/HannoteSearchApplication.java b/han-note-search/src/main/java/com/hanserwei/hannote/search/HannoteSearchApplication.java
new file mode 100644
index 0000000..e67042a
--- /dev/null
+++ b/han-note-search/src/main/java/com/hanserwei/hannote/search/HannoteSearchApplication.java
@@ -0,0 +1,11 @@
+package com.hanserwei.hannote.search;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class HannoteSearchApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(HannoteSearchApplication.class, args);
+ }
+}
diff --git a/han-note-search/src/main/java/com/hanserwei/hannote/search/config/ElasticsearchConfig.java b/han-note-search/src/main/java/com/hanserwei/hannote/search/config/ElasticsearchConfig.java
new file mode 100644
index 0000000..39aed72
--- /dev/null
+++ b/han-note-search/src/main/java/com/hanserwei/hannote/search/config/ElasticsearchConfig.java
@@ -0,0 +1,31 @@
+package com.hanserwei.hannote.search.config;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class ElasticsearchConfig {
+
+ @Value("${elasticsearch.host}")
+ private String host;
+
+ @Value("${elasticsearch.port}")
+ private int port;
+
+ @Value("${elasticsearch.scheme:http}")
+ private String scheme;
+
+ @Value("${elasticsearch.username:}")
+ private String username;
+
+ @Value("${elasticsearch.password:}")
+ private String password;
+
+ @Value("${elasticsearch.api-key:}")
+ private String apiKey;
+
+ @Value("${elasticsearch.use-api-key:false}")
+ private boolean useApiKey;
+
+
+}
diff --git a/han-note-search/src/main/java/com/hanserwei/hannote/search/enums/ResponseCodeEnum.java b/han-note-search/src/main/java/com/hanserwei/hannote/search/enums/ResponseCodeEnum.java
new file mode 100644
index 0000000..2e1b65a
--- /dev/null
+++ b/han-note-search/src/main/java/com/hanserwei/hannote/search/enums/ResponseCodeEnum.java
@@ -0,0 +1,23 @@
+package com.hanserwei.hannote.search.enums;
+
+import com.hanserwei.framework.common.exception.BaseExceptionInterface;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
+public enum ResponseCodeEnum implements BaseExceptionInterface {
+
+ // ----------- 通用异常状态码 -----------
+ SYSTEM_ERROR("SEARCH-10000", "出错啦,后台小哥正在努力修复中..."),
+ PARAM_NOT_VALID("SEARCH-10001", "参数错误"),
+
+ // ----------- 业务异常状态码 -----------
+ ;
+
+ // 异常码
+ private final String errorCode;
+ // 错误信息
+ private final String errorMsg;
+
+}
\ No newline at end of file
diff --git a/han-note-search/src/main/java/com/hanserwei/hannote/search/exception/GlobalExceptionHandler.java b/han-note-search/src/main/java/com/hanserwei/hannote/search/exception/GlobalExceptionHandler.java
new file mode 100644
index 0000000..2f2b83e
--- /dev/null
+++ b/han-note-search/src/main/java/com/hanserwei/hannote/search/exception/GlobalExceptionHandler.java
@@ -0,0 +1,103 @@
+package com.hanserwei.hannote.search.exception;
+
+import com.hanserwei.framework.common.exception.ApiException;
+import com.hanserwei.framework.common.response.Response;
+import com.hanserwei.hannote.search.enums.ResponseCodeEnum;
+import jakarta.servlet.http.HttpServletRequest;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.Optional;
+
+@SuppressWarnings("LoggingSimilarMessage")
+@ControllerAdvice
+@Slf4j
+public class GlobalExceptionHandler {
+
+ /**
+ * 捕获自定义业务异常
+ *
+ * @return Response.fail(e)
+ */
+ @ExceptionHandler({ApiException.class})
+ @ResponseBody
+ public Response