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

Mapping error: langid.enforceSchema option checks source field instead of target field

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.2, 6.0
    • Component/s: contrib - LangId
    • Labels:
      None

      Description

      I use LangDetect update processor with a document that has "body" field. LangDetect should map this field to "body_pl", "body_en" or "body_nolang". My schema defines fields with language suffixes, but not "body" field. When the processor runs, I get error:

      Unsuccessful field name mapping to body_nolang, field does not exist, skipping mapping.

      I looked up source code and it seems there's an error in org.apache.solr.update.processor.LanguageIdentifierUpdateProcessor.process(SolrInputDocument):

                String mappedOutputField = getMappedField(fieldName, fieldLang);
                if(enforceSchema && schema.getFieldOrNull(fieldName) == null) {
                  log.warn("Unsuccessful field name mapping to {}, field does not exist, skipping mapping.", mappedOutputField, fieldName);
                  mappedOutputField = fieldName;
                }
      

      I think it should check for schema.getFieldOrNull(mappedOutputField) instead.

        Attachments

          Activity

            People

            • Assignee:
              janhoy Jan Høydahl
              Reporter:
              mmatela Mateusz Matela
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: