From bbd7ecd872b13d3d8658aaa1de1a09a00831ccf2 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Sat, 17 Dec 2022 21:27:33 +0300
Subject: Empty search service for h2 environment
---
.../java/com/juick/service/NullSearchService.java | 44 ++++++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 src/main/java/com/juick/service/NullSearchService.java
(limited to 'src/main/java')
diff --git a/src/main/java/com/juick/service/NullSearchService.java b/src/main/java/com/juick/service/NullSearchService.java
new file mode 100644
index 00000000..efaccd53
--- /dev/null
+++ b/src/main/java/com/juick/service/NullSearchService.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2008-2022, Juick
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package com.juick.service;
+
+import com.juick.model.User;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.stereotype.Repository;
+
+import java.util.Collections;
+import java.util.List;
+
+@Repository
+@ConditionalOnProperty(name = "spring.sql.init.platform", havingValue = "h2")
+public class NullSearchService implements SearchService {
+ @Override
+ public void setMaxResult(int maxResult) {
+
+ }
+
+ @Override
+ public List searchInAllMessages(User visitor, String searchString, int messageIdBefore) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public List searchByStringAndUser(User visitor, String searchString, int userId, int messageIdBefore) {
+ return Collections.emptyList();
+ }
+}
--
cgit v1.2.3