Active
Project:
biblio_search_api
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
24 Mar 2014 at 11:03 UTC
Updated:
2 Sep 2014 at 08:43 UTC
Jump to comment: Most recent
Hi Jacob,
I also add this in order to add an index on biblio_types :
$info['node']['properties']['biblio_type'] = array(
'type' => 'text',
'label' => t('Biblio types'),
'sanitized' => TRUE,
'getter callback' => '_biblio_search_api_set_type_entity_value'
);and this function :
function _biblio_search_api_set_type_entity_value($item) {
$result = db_query('SELECT n.name FROM {biblio_types} n WHERE n.tid = :tid', array(':tid' => $item->biblio_type));
foreach ($result as $record) {
foreach ($record as $r) {return $r;}
}
}
If you agree could you add these lines to the biblio_search_api.module ?
Regards
Stéphanie
Comments
Comment #1
vegardjo commentedFirst: thanks for this module, adds some much needed functionality!
Also, I need the same thing as St_B here, but this change does not work for me. I've added the code which allowes me to select the "Biblio types" field in Search API, but no facet block for this becomes available. I've tried to index it both as a string and as full text.@St_b does this work for you?
EDIT: My bad, forgot to activate the facet.. +1 for including this functionality in the module!
Comment #2
sylvain_a commentedHello,
the functionality works correctly when applied to the version 1.02:
biblio_types becomes available as a field, and facets can be created.
For your information, although the functionnality works, I'm getting this error message:
Notice: Undefined property: stdClass::$biblio_type in _biblio_search_api_set_type_entity_value() (line 72 of xxx/modules/biblio_search_api/biblio_search_api.module).Comment #3
St_B commented@sylvain_a :
version 1.02 of what, Search API or biblio_search_api ? Here we are on search API 1.12 and applied only the commits available there https://www.drupal.org/node/2150745/commits