Skip to content

Apache Lucene open-source search software

SOLR-1230: Enhance data import developer console to work with all DataImportHandler request handlers

Erik Hatcher59a877489da5
diff --git a/contrib/dataimporthandler/CHANGES.txt b/contrib/dataimporthandler/CHANGES.txt
index 9049ef5bb25..3a396fac39c 100644
--- a/contrib/dataimporthandler/CHANGES.txt
+++ b/contrib/dataimporthandler/CHANGES.txt
@@ -142,7 +142,11 @@ New Features
32.SOLR-1092: Added a new command named 'import' which does not automatically clean the index. This is useful and
more appropriate when one needs to import only some of the entities.
(Noble Paul via shalin)
-33.SOLR-11153: 'deltaImportQuery' is honored on child entities as well (noble)
+
+33.SOLR-1153: 'deltaImportQuery' is honored on child entities as well (noble)
+
+34.SOLR-1230: Enhanced dataimport.jsp to work with all DataImportHandler request handler configurations,
+ rather than just a hardcoded /dataimport handler. (ehatcher)
Optimizations
----------------------
diff --git a/contrib/dataimporthandler/src/main/webapp/admin/dataimport.jsp b/contrib/dataimporthandler/src/main/webapp/admin/dataimport.jsp
index ff82d9c2c4a..3b9d71c1914 100644
--- a/contrib/dataimporthandler/src/main/webapp/admin/dataimport.jsp
+++ b/contrib/dataimporthandler/src/main/webapp/admin/dataimport.jsp
@@ -1,3 +1,6 @@
+<%@ page import="org.apache.solr.request.SolrRequestHandler" %>
+<%@ page import="java.util.Map" %>
+<%@ page import="org.apache.solr.handler.dataimport.DataImportHandler" %>
<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<%--
Licensed to the Apache Software Foundation (ASF) under one or more
@@ -16,9 +19,36 @@
limitations under the License.
--%>
<%-- do a verbatim include so we can use the local vars --%>
+<%@include file="_info.jsp"%>
<html>
+<%
+ String handler = request.getParameter("handler");
+
+ if (handler == null) {
+ Map<String, SolrRequestHandler> handlers = core.getRequestHandlers();
+%>
+<head>
+ <title>DataImportHandler Interactive Development</title>
+ <link rel="stylesheet" type="text/css" href="solr-admin.css">
+</head>
+<body>
+Select handler:
+<ul>
+<%
+ for (String key : handlers.keySet()) {
+ if (handlers.get(key) instanceof DataImportHandler) { %>
+ <li><a href="dataimport.jsp?handler=<%=key%>"><%=key%></a></li>
+<%
+ }
+ }
+%>
+</ul>
+</body>
+<% } else { %>
+
<frameset cols = "50%, 50%">
- <frame src ="debug.jsp" />
- <frame src ="../dataimport?command=full-import&debug=on&verbose=true" name="result"/>
+ <frame src ="debug.jsp?handler=<%=handler%>" />
+ <frame src ="../select?qt=<%=handler%>&command=status" name="result"/>
</frameset>
+<% } %>
</html>
diff --git a/contrib/dataimporthandler/src/main/webapp/admin/debug.jsp b/contrib/dataimporthandler/src/main/webapp/admin/debug.jsp
index 0475031d6cd..0ebdf635b1a 100644
--- a/contrib/dataimporthandler/src/main/webapp/admin/debug.jsp
+++ b/contrib/dataimporthandler/src/main/webapp/admin/debug.jsp
@@ -27,10 +27,17 @@
</head>
<body>
<h1>DataImportHandler Development Console</h1>
-<br />
-<form action="../dataimport" target="result" method="post">
-<input type="hidden" name="debug" value="on">
+<%
+ String handler = request.getParameter("handler"); // must be specified
+%>
+<form action="../select" target="result" method="get">
+<input type="hidden" name="debug" value="on"/>
+<input type="hidden" name="qt" value="<%=handler%>"/>
<table>
+ <tr>
+ <th>Handler: </th>
+ <td><%=handler%> <a href="dataimport.jsp" target="_top">change handler</a></td>
+ </tr>
<tr>
<td colspan="2">
<table width="100%">
@@ -49,7 +56,7 @@
name="clean" type="checkbox"></td>
<td><strong>Start Row</strong>&nbsp;<input
name="start" size="4" type="text" value="0"></td>
- <td><strong>No:of Rows</strong>&nbsp;<input name="rows"
+ <td><strong>No. of Rows</strong>&nbsp;<input name="rows"
type="text" size="4" value="10"></td>
</tr>
</table>
@@ -61,17 +68,18 @@
</tr>
<tr>
<td colspan="2"><textarea id="txtDataConfig" rows="30" cols="80" name="dataConfig"></textarea></td>
- <script type="text/javascript" language="Javascript">
- $.get('../dataimport?command=show-config', function(data){
- $('#txtDataConfig').attr('value', data);
- });
- </script>
+ <script type="text/javascript" language="javascript">
+ $.get("../select?qt=<%=handler%>&command=show-config", function(data){
+ $('#txtDataConfig').attr('value', data);
+ });
+ </script>
</tr>
</table>
</form>
-<form action="../dataimport" target="result" method="get">
+<form action="../select" target="result" method="get">
<input type="hidden" name="clean" value="false">
<input type="hidden" name="commit" value="true">
+ <input type="hidden" name="qt" value="<%=handler%>"/>
<input class="stdbutton" type="submit" name="command" value="full-import">
<input class="stdbutton" type="submit" name="command" value="delta-import">
<input class="stdbutton" type="submit" name="command" value="status">
@@ -84,13 +92,15 @@
<input type="hidden" name="rows" value="0">
<input class="stdbutton" type="submit" value="Documents Count">
</form>
-<form action="../dataimport" target="result" method="get">
+<form action="../select" target="result" method="get">
+ <input type="hidden" name="qt" value="<%=handler%>"/>
<input type="hidden" name="verbose" value="true">
<input type="hidden" name="clean" value="true">
<input type="hidden" name="commit" value="true">
<input type="hidden" name="command" value="full-import">
<input class="stdbutton" type="submit" value="Full Import with Cleaning">
</form>
+
<a href="index.jsp" target="_parent">Return to Admin Page</a>
</body>
</html>