hi.
i'm using search api to index my content and i programmatically created a new indexed node property using hook_entity_property_info_alter():
$entity_info["node"]["properties"]["author_offerta_id_latest"] = array(
"type" => "integer",
"label" => "[sb][code] Author latest offerta ID",
"sanitized" => TRUE,
"getter callback" => "_getSearchAPIAuthorOffertaIdLatest"
);
it all works fine and i got my field indexed correctly. now i'd like to add this custom field to one of my view mode but it seems i'm not able to.
i've investigated using dpm() and it seems that both the involved entity and the bundle are equal to search_api_index so i tried to manually add an extra field using ds_extras adding this line: search_api_index|search_api_index|author_offerta_id_latest
but the field doesn't show up.
the field i'd like to add to my view mode is a column named author_offerta_id_latest in the table search_api_db_node_index.
any suggestion?
thanks a lot!
Comments
Comment #1
aspilicious commentedI'm not sure I understand everything but maybe this helps you
Comment #2
lorenx commentedok, thank you. i'm now able to see my custom field.
but i still have a big doubt anyway.
the above code is to add a field to entities of type node and it works fine. actually, if i go to admin/structure/ds/view_modes/manage to add a new view mode, i can only choose between node, taxonomy term, comment and user.
i don't know if you have ever used the
search apimodule but, indexing content, it creates another type of entity called search_api_index, that had it's own database table.now, i'm just wondering if it's possibile to create a view mode on this new entity, to take full advantage of the indexed nodes (instead of querying the original node table) so that i don't have to retrieve that field twice (once while indexing and once for ds).
let me know if i explained my doubt in a clear way,
thanks a lot.
Comment #3
aspilicious commentedSearch api index doesn't have a "view" so it doesn't has a view_mode. You can't render a search api index.
Comment #4
aspilicious commentedLooks like I answered all your questions.