SOLR-4991: Register QParserPlugins as SolrInfoMBeans

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1501863 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erik Hatcher 2013-07-10 17:27:08 +00:00
parent 7f1765f1fa
commit c3bc304aaf
5 changed files with 47 additions and 2 deletions

View File

@ -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
----------------------

View File

@ -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);

View File

@ -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,

View File

@ -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;
}
}

View File

@ -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 ); }