diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index c847386c5b8..82b377cc6fc 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -177,6 +177,8 @@ New Features * SOLR-5010: Add support for creating copy fields to the Schema REST API (gsingers) +* SOLR-4991: Register QParserPlugins as SolrInfoMBeans (ehatcher) + Bug Fixes ---------------------- diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.java index 60f6ac158b5..c87fe67bbac 100644 --- a/solr/core/src/java/org/apache/solr/core/SolrCore.java +++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java @@ -2091,6 +2091,7 @@ public final class SolrCore implements SolrInfoMBean { QParserPlugin plugin = clazz.newInstance(); qParserPlugins.put(name, plugin); plugin.init(null); + infoRegistry.put(name, plugin); } } catch (Exception e) { throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e); diff --git a/solr/core/src/java/org/apache/solr/core/SolrInfoMBean.java b/solr/core/src/java/org/apache/solr/core/SolrInfoMBean.java index 8458e1fe8d2..ac6137a9d81 100644 --- a/solr/core/src/java/org/apache/solr/core/SolrInfoMBean.java +++ b/solr/core/src/java/org/apache/solr/core/SolrInfoMBean.java @@ -30,7 +30,7 @@ import org.apache.solr.common.util.NamedList; */ public interface SolrInfoMBean { - public enum Category { CORE, QUERYHANDLER, UPDATEHANDLER, CACHE, HIGHLIGHTING, OTHER }; + public enum Category { CORE, QUERYHANDLER, UPDATEHANDLER, CACHE, HIGHLIGHTING, QUERYPARSER, OTHER }; /** * Simple common usage name, e.g. BasicQueryHandler, diff --git a/solr/core/src/java/org/apache/solr/search/QParserPlugin.java b/solr/core/src/java/org/apache/solr/search/QParserPlugin.java index 8758ad84533..e1acb1cbb14 100755 --- a/solr/core/src/java/org/apache/solr/search/QParserPlugin.java +++ b/solr/core/src/java/org/apache/solr/search/QParserPlugin.java @@ -17,10 +17,14 @@ package org.apache.solr.search; import org.apache.solr.common.params.SolrParams; +import org.apache.solr.common.util.NamedList; +import org.apache.solr.core.SolrInfoMBean; import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.util.plugin.NamedListInitializedPlugin; -public abstract class QParserPlugin implements NamedListInitializedPlugin { +import java.net.URL; + +public abstract class QParserPlugin implements NamedListInitializedPlugin, SolrInfoMBean { /** internal use - name of the default parser */ public static String DEFAULT_QTYPE = LuceneQParserPlugin.NAME; @@ -48,6 +52,43 @@ public abstract class QParserPlugin implements NamedListInitializedPlugin { /** return a {@link QParser} */ public abstract QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req); + + @Override + public String getName() { + // TODO: ideally use the NAME property that each qparser plugin has + + return this.getClass().getName(); + } + + @Override + public String getVersion() { + return null; + } + + @Override + public String getDescription() { + return ""; // UI required non-null to work + } + + @Override + public Category getCategory() { + return Category.QUERYPARSER; + } + + @Override + public String getSource() { + return "$URL$"; + } + + @Override + public URL[] getDocs() { + return new URL[0]; + } + + @Override + public NamedList getStatistics() { + return null; + } } diff --git a/solr/webapp/web/css/styles/plugins.css b/solr/webapp/web/css/styles/plugins.css index 85e5ab1f483..f8ea76934ff 100644 --- a/solr/webapp/web/css/styles/plugins.css +++ b/solr/webapp/web/css/styles/plugins.css @@ -28,6 +28,7 @@ limitations under the License. #content #plugins #navigation .highlighting a { background-image: url( ../../img/ico/highlighter-text.png ); } #content #plugins #navigation .updatehandler a{ background-image: url( ../../img/ico/arrow-circle.png ); } #content #plugins #navigation .queryhandler a { background-image: url( ../../img/ico/magnifier.png ); } +#content #plugins #navigation .queryparser a { background-image: url( ../../img/ico/asterisk.png ); } #content #plugins #navigation .PLUGINCHANGES { margin-top: 20px; } #content #plugins #navigation .PLUGINCHANGES a { background-image: url( ../../img/ico/eye.png ); }