Solr
  1. Solr
  2. SOLR-1986

Allow users to define multiple subfield types in AbstractSubTypeFieldType

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Schema and Analysis
    • Labels:
      None

      Description

      A few small changes to the AbstractSubTypeFieldType class to allow users to define distinct field types for each subfield. This enables us to define complex data types in the schema.

      For example, we have our own subclass of the CoordinateFieldType called TemporalCoverage where we store a start and end date for an event but now we can store a name for the event as well.

      <fieldType name="temporal" class="uk.ac.edina.solr.schema.TemporalCoverage" dimension="3" subFieldSuffix="_ti,_ti,_s"/>

      In this example, the start and end dates get stored as trie-coded integer subfields and the description as a string subfield.

      1. SOLR-1986.patch
        16 kB
        Thomas Joiner
      2. AbstractMultiSubTypeFieldType.patch
        6 kB
        Thomas Joiner
      3. multiSubType.patch
        2 kB
        Mark Allan

        Issue Links

          Activity

          Mark Allan created issue -
          Hide
          Mark Allan added a comment -

          Patch to provide initial functionality of multiple subfield types.

          Show
          Mark Allan added a comment - Patch to provide initial functionality of multiple subfield types.
          Mark Allan made changes -
          Field Original Value New Value
          Attachment multiSubType.patch [ 12448684 ]
          Mark Allan made changes -
          Link This issue depends on SOLR-1131 [ SOLR-1131 ]
          Hide
          Mark Allan added a comment -

          Allows for definition of multiple different subfield types.

          Show
          Mark Allan added a comment - Allows for definition of multiple different subfield types.
          Hide
          Lance Norskog added a comment -

          +1

          I would like to add a Level-Of-Detail value to the spatial types. Without this it is impossible.

          In fact, I would like to compose types with compound type as a subfield. Is this possible?

          Show
          Lance Norskog added a comment - +1 I would like to add a Level-Of-Detail value to the spatial types. Without this it is impossible. In fact, I would like to compose types with compound type as a subfield. Is this possible?
          Hide
          Thomas Joiner added a comment -

          Since the reason people seemed to object to the patch in the mailing list was that the AbstractSubTypeFieldType was not originally intended to be used for multiple different types, I made it a separate class. Also, the subFieldType parameter now works, and the created subFields are prepended with "subtype_" so as to allow dynamicFields to be used to simulate multiValued fields.

          Show
          Thomas Joiner added a comment - Since the reason people seemed to object to the patch in the mailing list was that the AbstractSubTypeFieldType was not originally intended to be used for multiple different types, I made it a separate class. Also, the subFieldType parameter now works, and the created subFields are prepended with "subtype_" so as to allow dynamicFields to be used to simulate multiValued fields.
          Thomas Joiner made changes -
          Attachment AbstractMultiSubTypeFieldType.patch [ 12453074 ]
          Hide
          Otis Gospodnetic added a comment -

          This looks useful. Thomas or Mark, would you happen to have a unit test to go with this?

          Show
          Otis Gospodnetic added a comment - This looks useful. Thomas or Mark, would you happen to have a unit test to go with this?
          Hide
          Thomas Joiner added a comment -

          I don't currently have a test for it, however I will see about making one (it may take a while as work has me quite busy right now).

          Show
          Thomas Joiner added a comment - I don't currently have a test for it, however I will see about making one (it may take a while as work has me quite busy right now).
          Hide
          Thomas Joiner added a comment -

          Finally had a chance to create some tests for it. I think that the tests that I made cover the functionality of the class fairly well, however if you have any feedback/improvements that you would like me to make, please feel free.

          I also improved the documentation for the AbstractMultiSubTypeFieldType class...most of the commenting is probably completely unnecessary for anyone with any familiarity with the Solr core, however to anybody who is trying to create a custom type that isn't familiar with the core, it should help them understand what the class is doing a little bit.

          Note that this patch should be applied independently of the original patch

          Show
          Thomas Joiner added a comment - Finally had a chance to create some tests for it. I think that the tests that I made cover the functionality of the class fairly well, however if you have any feedback/improvements that you would like me to make, please feel free. I also improved the documentation for the AbstractMultiSubTypeFieldType class...most of the commenting is probably completely unnecessary for anyone with any familiarity with the Solr core, however to anybody who is trying to create a custom type that isn't familiar with the core, it should help them understand what the class is doing a little bit. Note that this patch should be applied independently of the original patch
          Thomas Joiner made changes -
          Attachment SOLR-1986.patch [ 12477261 ]
          Gavin made changes -
          Link This issue depends on SOLR-1131 [ SOLR-1131 ]
          Gavin made changes -
          Link This issue depends upon SOLR-1131 [ SOLR-1131 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Mark Allan
            • Votes:
              4 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 48h
                48h
                Remaining:
                Remaining Estimate - 48h
                48h
                Logged:
                Time Spent - Not Specified
                Not Specified

                  Development