The docblock for Index::addField() implies the method can, under certain circumstances, update an existing field. This functionality was removed at https://cgit.drupalcode.org/search_api/diff/src/Entity/Index.php?id=69cf213 (see diff around line 565, etc.)
I would like to be able to update fields, however it looks like this change was purposeful and I'm not familiar enough with the internals to submit a patch to add a method, so this is just a quickie to at least update the docblock so others don't rely on this capability like I did, only to get an Exception later.
Thanks for all the great work on search api and I hope I can help more in the future.
Comments
Comment #2
borisson_Awesome! Documentation updates are great. Thank you!
Comment #4
drunken monkeyI agree, thanks a lot!
Committed.
And you're right, this was done on purpose. Now you either need to first remove the existing field (if you want a completely new definition) or just get the current field and change its settings as appropriate. E.g., like we do in
BackendTestBase:If you have an idea how to better document this, please go ahead and propose it (or add it to our online documentation).