Skip to content

EDTFDateStringCF's dump/load does not support multiple #634

Open
@J4bbi

Description

@J4bbi

Package version (if known): 5+

Describe the bug

The EDTFDateStringCF dump and load methods do not allow for multiple values.

The dump method currently iterates through a loop, but overwrites the single value, resulting in the last value in the loop being set as the single value (see here).

This means that if an EDTFDateStringCF has multiple values, the last value will be set, e.g.:

"mex:start": {
    "date": "1921-08-10",
    "date_range": {
        "gte": "1921-08-10",
         "lte": "1921-08-10"
    }
},

The output from an internal query would be:
['1', '9', '2', '1', '-', '0', '8', '-', '1', '0']

since, if it is a multiple field, it expects an array of values.

Steps to Reproduce

  1. Create a EDTFDateStringCF custom field with multiple=True
  2. Set it's value to a list of two or more dates, .e.g. ["2010-10-28", "1921-08-10"]
  3. Confirm that the index only contains the above value
  4. Confirm that an internal query break the single date string into characters (current_rdm_records_service.search)

Expected behavior

EDTFDateStringCF with multiple set, should be able to index multiple date values correctly and load and dump them.

Screenshots (if applicable)

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions