Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-7697

Schema API doesn't take class or luceneMatchVersion attributes into account for the analyzer when adding a new field type

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.2
    • Fix Version/s: 5.3, 6.0
    • Component/s: Schema and Analysis
    • Labels:
      None

      Description

      I've noticed that in schema.xml can be defined field types like the following :

          <fieldType name="nametext" class="solr.TextField">
            <analyzer class="org.apache.lucene.analysis.core.WhitespaceAnalyzer"/>
          </fieldType>
      

      The current add-field-type update operation from Schema API doesn't take into account the class (and the luceneMatchVersion - see FieldTypePluginLoader.java) for the field type analyzer definition, but only their type.

      See FieldTypeXmlAdapter.java

        protected static Element createAnalyzerElement(Document doc, String type, Map<String,?> json) {
          Element analyzer = doc.createElement("analyzer");
          if (type != null)
            analyzer.setAttribute("type", type);
            .....
      

      If the change would be made, the add-field-type request would look like this :

      curl -X POST -H 'Content-type:application/json' --data-binary '{
        "add-field-type": {
          "name": "nametext",
          "class": "solr.TextField",
          "analyzer": {
            "class": "org.apache.lucene.analysis.core.WhitespaceAnalyzer"
          }
        }
      }' http://localhost:8983/solr/gettingstarted/schema
      

        Attachments

        1. SOLR-7697.patch
          4 kB
          Marius Grama
        2. SOLR-7697.patch
          10 kB
          Steve Rowe

          Issue Links

            Activity

              People

              • Assignee:
                steve_rowe Steve Rowe
                Reporter:
                mariusneo Marius Grama
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: