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

vegardjo’s picture

First: 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!

sylvain_a’s picture

Hello,
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).

St_B’s picture

@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