On 10/12/2017 3:18 PM, Manikandan Sivanesan wrote:
I'm looking for a way to disable the query parser XmlQParserPlugin
(org.apache.solr.search.XmlQParserPlugin) through solrconfig.xml .
Following the instructions mentioned here
<https://wiki.apache.org/solr/SolrConfigXml#Enable.2Fdisable_components> to
disable a query parser.

This is the part that I added to solrconfig.
<queryParser name="xmlparser" class="XmlQParserPlugin"
enable="{enable.xmlparser:false}/>

I have uploaded it to zk and reloaded the collection. But I still see the
XmlQParserPlugin loaded in
in the Plugin/Stats => QUERYPARSER section of Solr Admin Console.

Through experimentation, I was able to figure out that the configuration of query parsers DOES support the "enable" attribute.  Initially I thought it might not.

With this invalid configuration (the class is missing a character), Solr will start correctly:

<queryParser name="flibble" class="solr.XmlQParserPlugi" enable="false"/>

But if I change the enable attribute to "true" instead of "false", Solr will NOT successfully load the core with that config, because it contains a class that cannot be found.

The actual problem you're running into is that almost every query parser implementation that Solr has is hard-coded and explicitly loaded by code in QParserPlugin.  One of those parsers is the XML parser that you want to disable.

I think it would be a good idea to go through the list of hard-coded parsers in the QParserPlugin class and make it a MUCH smaller list.  Some of the parsers, especially the XML parser, probably should require explicit configuration rather than being included by default.

Thanks,
Shawn

Reply via email to