Hello,

I'm creating a custom processor that adds some fields to the index. I'm using alterPropertyDefinitions(), for definition, preprocessIndexItems() for adding some fields and preIndexSave() where I use ensureField().

It works well for all fields that I'm adding except for the 'date' field type.

I don't know if the solution is to

  1. Modify the getFieldTypeMapping() adding also 'date'.
    'date' => array(
        'datetime_iso8601',
        'timestamp',
    ),
    

    Should be

    'date' => array(
        'date',
        'datetime_iso8601',
        'timestamp',
    ),
    
  2. Call ensureField() making sure that the third param is always added.
    $this->ensureField(NULL, $field_id, $field_definition['type']);

Both of them solve the issue, but I don't know about which one to use. I added a patch, just in case the first option is the right one.

Comments

TuWebO created an issue. See original summary.

tuwebo’s picture

Status: Active » Needs review
StatusFileSize
new301 bytes

Created a patch for it.

tuwebo’s picture

Issue summary: View changes

drunken monkey’s picture

Status: Needs review » Fixed

It's not really a bug per se, as those types in the property definitions aren't the same types as the Search API uses, but those that Core uses. So, you could just use timestamp there instead of date in your processor and you'd be fine.
However, having the Search API type available there, too, of course also makes sense – we already have that for all other types, I think. So, thanks for the patch – committed.

tuwebo’s picture

Thanks a lot for the explanation and the commit.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.