<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%> <%-- 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. --%> <%@ page import="org.apache.solr.common.util.NamedList, org.apache.solr.common.util.SimpleOrderedMap, org.apache.solr.request.LocalSolrQueryRequest, org.apache.solr.response.SolrQueryResponse, org.apache.solr.request.SolrRequestHandler, java.util.Map"%> <%@ page import="org.apache.solr.handler.ReplicationHandler" %> <% request.setCharacterEncoding("UTF-8"); %> <%@include file="../_info.jsp" %> Solr replication admin page <%! public NamedList executeCommand(String command, SolrCore core, SolrRequestHandler rh){ NamedList namedlist = new SimpleOrderedMap(); namedlist.add("command", command); LocalSolrQueryRequest solrqreq = new LocalSolrQueryRequest(core, namedlist); SolrQueryResponse rsp = new SolrQueryResponse(); core.execute(rh, solrqreq, rsp); namedlist = rsp.getValues(); return namedlist; } %> <% final Map all = core.getRequestHandlers(ReplicationHandler.class); if(all.isEmpty()){ response.sendError( 404, "No ReplicationHandler registered" ); return; } // :HACK: we should be more deterministic if multiple instances final SolrRequestHandler rh = all.values().iterator().next(); NamedList namedlist = executeCommand("details",core,rh); NamedList detailsMap = (NamedList)namedlist.get("details"); %> Solr

Solr replication (<%= collectionName %>) <% if(detailsMap != null){ if( "true".equals(detailsMap.get("isMaster")) && "true".equals(detailsMap.get("isSlave"))) out.println(" Master & Slave"); else if("true".equals(detailsMap.get("isMaster"))) out.println(" Master"); else if("true".equals(detailsMap.get("isSlave"))) out.println(" Slave"); } %>

<%= hostname %>:<%= port %>
cwd=<%= cwd %> SolrHome=<%= solrHome %>