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
- Modify the getFieldTypeMapping() adding also 'date'.
'date' => array(
'datetime_iso8601',
'timestamp',
),
Should be
'date' => array(
'date',
'datetime_iso8601',
'timestamp',
),
- 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
Comment #2
tuwebo commentedCreated a patch for it.
Comment #3
tuwebo commentedComment #5
drunken monkeyIt'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
timestampthere instead ofdatein 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.
Comment #6
tuwebo commentedThanks a lot for the explanation and the commit.