You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by zj...@apache.org on 2020/12/23 01:17:42 UTC
[zeppelin] branch branch-0.9 updated: [ZEPPELIN-5155]. Add option
to disable search
This is an automated email from the ASF dual-hosted git repository.
zjffdu pushed a commit to branch branch-0.9
in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/branch-0.9 by this push:
new d7b9c21 [ZEPPELIN-5155]. Add option to disable search
d7b9c21 is described below
commit d7b9c21c381f603325b3c05fb03ce3c286e077b4
Author: Jeff Zhang <zj...@apache.org>
AuthorDate: Tue Dec 22 13:01:37 2020 +0800
[ZEPPELIN-5155]. Add option to disable search
### What is this PR for?
This introduce property `zeppelin.search.enable` so that user can disable search in some case (e.g. use zeppelin as job server).
### What type of PR is it?
[ Improvement ]
### Todos
* [ ] - Task
### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-5155
### How should this be tested?
* CI pass
### Screenshots (if appropriate)
### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No
Author: Jeff Zhang <zj...@apache.org>
Closes #3996 from zjffdu/ZEPPELIN-5155 and squashes the following commits:
c34a6930a [Jeff Zhang] address comment
668f2daa3 [Jeff Zhang] [ZEPPELIN-5155]. Add option to disable search
(cherry picked from commit a91d3bf31f779738e3a373563b5b4e6869cb462d)
Signed-off-by: Jeff Zhang <zj...@apache.org>
---
.../zeppelin/conf/ZeppelinConfiguration.java | 1 +
.../org/apache/zeppelin/server/ZeppelinServer.java | 7 +-
.../apache/zeppelin/search/NoSearchService.java | 78 ++++++++++++++++++++++
3 files changed, 85 insertions(+), 1 deletion(-)
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
index d76b2b5..3eb8e41 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
@@ -1128,6 +1128,7 @@ public class ZeppelinConfiguration extends XMLConfiguration {
ZEPPELIN_PROXY_URL("zeppelin.proxy.url", null),
ZEPPELIN_PROXY_USER("zeppelin.proxy.user", null),
ZEPPELIN_PROXY_PASSWORD("zeppelin.proxy.password", null),
+ ZEPPELIN_SEARCH_ENABLE("zeppelin.search.enable", true),
ZEPPELIN_SEARCH_INDEX_REBUILD("zeppelin.search.index.rebuild", false),
ZEPPELIN_SEARCH_USE_DISK("zeppelin.search.use.disk", true),
ZEPPELIN_SEARCH_INDEX_PATH("zeppelin.search.index.path", "/tmp/zeppelin-index"),
diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java b/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
index bf55006..71ecc09 100644
--- a/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
+++ b/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
@@ -90,6 +90,7 @@ import org.apache.zeppelin.notebook.scheduler.SchedulerService;
import org.apache.zeppelin.plugin.PluginManager;
import org.apache.zeppelin.rest.exception.WebApplicationExceptionMapper;
import org.apache.zeppelin.search.LuceneSearch;
+import org.apache.zeppelin.search.NoSearchService;
import org.apache.zeppelin.search.SearchService;
import org.apache.zeppelin.service.*;
import org.apache.zeppelin.service.AuthenticationService;
@@ -181,7 +182,6 @@ public class ZeppelinServer extends ResourceConfig {
Credentials credentials = new Credentials(conf);
bindAsContract(InterpreterFactory.class).in(Singleton.class);
bindAsContract(NotebookRepoSync.class).to(NotebookRepo.class).in(Immediate.class);
- bind(LuceneSearch.class).to(SearchService.class).in(Singleton.class);
bindAsContract(Helium.class).in(Singleton.class);
bind(conf).to(ZeppelinConfiguration.class);
bindAsContract(InterpreterSettingManager.class).in(Singleton.class);
@@ -218,6 +218,11 @@ public class ZeppelinServer extends ResourceConfig {
} else {
bind(NoSchedulerService.class).to(SchedulerService.class).in(Singleton.class);
}
+ if (conf.getBoolean(ConfVars.ZEPPELIN_SEARCH_ENABLE)) {
+ bind(LuceneSearch.class).to(SearchService.class).in(Singleton.class);
+ } else {
+ bind(NoSearchService.class).to(SearchService.class).in(Singleton.class);
+ }
}
});
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/search/NoSearchService.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/search/NoSearchService.java
new file mode 100644
index 0000000..058e7c5
--- /dev/null
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/search/NoSearchService.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zeppelin.search;
+
+import org.apache.zeppelin.conf.ZeppelinConfiguration;
+import org.apache.zeppelin.notebook.Note;
+import org.apache.zeppelin.notebook.Paragraph;
+
+import javax.inject.Inject;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Stream;
+
+public class NoSearchService extends SearchService {
+
+ @Inject
+ public NoSearchService() {
+ super("NoSearchService-Thread");
+ }
+
+ @Override
+ public List<Map<String, String>> query(String queryStr) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public void updateNoteIndex(Note note) throws IOException {
+
+ }
+
+ @Override
+ public void updateParagraphIndex(Paragraph paragraph) throws IOException {
+
+ }
+
+ @Override
+ public void addNoteIndex(Note note) throws IOException {
+
+ }
+
+ @Override
+ public void addParagraphIndex(Paragraph pargaraph) throws IOException {
+
+ }
+
+ @Override
+ public void deleteNoteIndex(Note note) throws IOException {
+
+ }
+
+ @Override
+ public void deleteParagraphIndex(String noteId, Paragraph p) throws IOException {
+
+ }
+
+
+ @Override
+ public void startRebuildIndex(Stream<Note> notes) {
+
+ }
+}