All the components initialized by Solr have an init(NamedList args)
initializer. This leads us to writing the configuration needed for the
component in the NamedList format. People familiar with Solr may know
the format but most of what is wrtten is noise than information. For
users who are not familiar w/ the format find it too difficult to
understand why they have to write it this way

For example the spellcheckcoponent have a configuration as follows
<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
      <lst name="spellchecker">
         <str name="name">default</str>
         <str 
name="classname">org.apache.solr.spelling.IndexBasedSpellChecker</str>
         <str name="field">spell</str>
         <str name="spellcheckIndexDir">./spellchecker</str>
    </lst>
</searchComponent>

The most intuitive format for the above configuration would be

as follows
<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
      <spellchecker>
        <name>default</name>
        <classname>org.apache.solr.spelling.IndexBasedSpellChecker</classname>
        <field>spell</field>
        <spellcheckIndexDir>./spellchecker</spellcheckIndexDir>
    </spellchecker>
</searchComponent>

This enhancement can be done automatically by modifying the DOMUtil
class to read the second format to create the namedlist . The new
rules for constructing the namedlist can be.
 * if a tag contains subtags it will be treated <lst>
 * The tag name will be considered as the 'name'
 * All the attributes values will be treated as string.

This can be further enhanced w/ the following rule
* A tag contains attributes will also be a <lst>
* Each attribute will be a String value
The following can be made equivalent to
<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
 <spellchecker name="default"

classname="org.apache.solr.spelling.IndexBasedSpellChecker"
                      field="spell"
                      spellcheckIndexDir="./spellchecker"/>
</searchComponent>

The only problem I see w/ this change is that any plugin that relies
on the type to be something other than string may fail. But that
should not be an excuse for all the new components paying the
"NamedList tax"
--Noble







-- 
--Noble Paul

Reply via email to