aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-12-17 21:27:33 +0300
committerGravatar Vitaly Takmazov2022-12-17 21:27:33 +0300
commitbbd7ecd872b13d3d8658aaa1de1a09a00831ccf2 (patch)
tree4d7a5d483cd1b62379dd03a266b175c57b88671d /src
parenta6e17eb7aa1366a29a1c23b4bd40a3eb253f8ca9 (diff)
Empty search service for h2 environment
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/juick/service/NullSearchService.java44
1 files changed, 44 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>.
+ */
+
+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<Integer> searchInAllMessages(User visitor, String searchString, int messageIdBefore) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public List<Integer> searchByStringAndUser(User visitor, String searchString, int userId, int messageIdBefore) {
+ return Collections.emptyList();
+ }
+}