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

Solr DataImportHandler not finding dynamic fields

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 4.7
    • Fix Version/s: 4.9
    • Labels:
      None

      Description

      There is an issue with org.apache.solr.handler.dataimport.DocBuilder:addFields around ~line 643. The logic currently says see if you can find the field from the schema, ie:

      DocBuilder.java
      SchemaField sf = schema.getFieldOrNull(key);
      

      and, if not found, go ask DIHConfiguration to find it, ie:

      DocBuilder.java
      sf = config.getSchemaField(key);
      

      The latter call takes into account case-insensitivity, which is a big deal since some databases, ie: DB2, upper case all the resulting column names. In order to not modify solr-core (ie: the match logic in IndexSchema), I'm attaching a patch that makes DIHConfiguration apply the same case-insensitive logic to the DynamicFields.

      Without this patch, dynamic fields will not be added to the index unless you declare them like this:

        <dynamicField name="*_S" type="string" indexed="true" stored="true" />
      

      (note the capital S)

      which is in-consistent with what I believe to be solr schema conventions to have all the schema fields as lower-case.

      Thanks.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              aaronlab Aaron LaBella
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: