so there's an excellent working code example for this at http://www.koumbit.org/en/articles/how-integrate-fivestar-ratings-apache...

how much of a leap would it be to build this into the module for d7 so that the five star ratings are properly passed through on vote submission and also exposed as one of the facets in solr settings?

Comments

ericduran’s picture

This should be rather simple on the 7.x I believe. Fivestar are already fields, so it should be the same as display any other field in solr so you should be able to also added to the solr index, etc.

I personally haven't tried this but I think my assumption is correct.

zilla’s picture

yes, but oddly the five star field is not accessible as a facet in the solr search admin interface - any idea if its possible to have the module deliver this versus approaching it from solr?

ericduran’s picture

Yea, I'll look into this. I don't see why not.

zilla’s picture

thanks eric.

BeaPower’s picture

any news?

Louis Bob’s picture

Yes, I have the same need: I can't find the Fivestar fields listed with the Apache Solr facets fields...
Any news?

BeaPower’s picture

how can this be integrated into search solr api?

strawman’s picture

Was there any progression on this. Still looking around for a way to do this. Not happening on my site yet.

zilla’s picture

there are now a couple of folks working on this - google (because drupal site search is rough :) "fivestar search api" and "voting api solr" and you'll see two approaches, one is a live module with no current facet (it's in the plan) and the other is a sandbox specific to five star

the current problem is that even though you can expose the field for the index, it is not correctly counting results (just zero's), which renders it sort of worthless at a basic implementation.

would somebody consider wrapping the code at http://www.koumbit.org/en/articles/how-integrate-fivestar-ratings-apache... into a module for d7 and current fivestar for a bounty? if so, ping me via contact. i'd love to see it rolled into this project page for fivestar somehow!

NewZeal’s picture

It appears that the suggestions on the link supplied at #9 apply to older versions of apachesolr module. hook_apachesolr_update_index() appears to be replaced by

function hook_apachesolr_index_document_build(ApacheSolrDocument $document, $entity, $entity_type, $env_id) {
  $votes =  fivestar_get_votes('node', $entity->nid);
  $average = $votes['average']['value'];
  $value = empty($average) ? 0 : $average;
  $document->addField('is_like', $value);
}

function hook_apachesolr_query_prepare( DrupalSolrQueryInterface $query) {
  $query->setAvailableSort('is_like', array(
    // how the sort link is to appear in the sorts block
    'title' => t('Likes'),
    'default' => 'desc', 
  ));
}

Using the above two appears to expose the fivestar field, in this case called is_like.