Atleast Solr based search won't index five star rating field ratings corrently. This module aims to fix it. You can use fivestar ratings for facets with this module.

Currently it provides the following functionality:
- Makes Search API indexes to index rating values correctly according to settings.
- Updates votes in realtime to selected indexes after vote is cast
- Provides 3 new fields to index

Limitations:
Currently works only on entities that have single rating field.

Installation:
By default it works on 5 star rating fields on all indexes. You can limit instant indexing to certain indexes from options page. If you use different amount of stars than 5, you can choose between 1-10. Notice: This applies to all ratings currently.

Dependencies:
- Voting Rules
- Search API
- Fivestar

Link to sandbox

Git clone: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/Demoshane/1948758.git search_api_fivestar

This is a Drupal 7 -module

PAReview: PAReview

Comments

PA robot’s picture

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

balajidharma’s picture

Hi Demoshane,

Add [D7] in issue title ( [D7] Search API Fivestar ).

Demoshane’s picture

Title: Search API Fivestar » [D7] Search API Fivestar

Done.

Sean Buscay’s picture

Hello Demoshane.

I've added a couple of quick notes before trying your module out and giving further feedback.

Here are the few notes:

1. Your readme file is blank. Do you want to add more info to it? Perhaps at least what's on your project description page.

2. You mention on the project page that the Solr won't index the five star ratings correctly. Can you describe that further? For example, saying what it does now and what it actually should do and how your module fixes this.

3. Minor note: You have a variable name "avarage" in search_api_fivestar.module on line 52. Perhaps this is on purpose?

4. I'm curious about the performance of the calculations in: search_api_fivestar_current_user_rating_getter_callback and search_api_fivestar_avarage_user_rating_getter_callback. Are they not called that often? Is there any need for caching?

More to come. Hope this helps.

Demoshane’s picture

1. I'll fix the readme
2. Basically Solr indexes rating fields as empty. This module inserts the rating field data in correct format to the index and exposes it as new fields
3. I'll check that.
4. I'll evaluate this. Doubt there is any noticeable performance hit.

artem_sylchuk’s picture

Status: Needs review » Needs work

Please change status only after applying described changes.
Also, please consider this https://drupal.org/node/539608 page. Your application cannot be accepted till you fixed mentioned problems.

Demoshane’s picture

James, more like: remember to change status after reviewing :)

Demoshane’s picture

Status: Needs work » Needs review

For Sean:
1. Added basic information to README
2. Replied earlier
3. Yes, it's on purpose
4. They're called on need. If you got suggestion how to improve this, please let me know. Though I don't think there is much to do.

zilla’s picture

This is an excellent module that I'd like to see moved to a live project page. I will be assisting with documentation for the initial project page release (provided module creator supports this, which we've discussed over email).

This will include augmenting the existing "Readme" file that accompanies the module.

kscheirer’s picture

Status: Needs review » Reviewed & tested by the community

Your project page says "Atleast", and "Avarage" is misspelled in some variable and function names, it should be "average".

Could this module live as part of the fivestar or searchapi modules? Would users expect this to be the default behavior without having to include a contrib module?

----
Top Shelf Modules - Crafted, Curated, Contributed.

zilla’s picture

i don't understand why it would be included with five star or searchapi - both of those modules already have "extras" modules surrounding them, as do countless others on drupal.

in the case of fivestar, it would seem to make some sense but would then place an additional support burden on the fivestar maintainer who is already inundated with requests for support or features on the already popular module. in that scenario, feature requests or support requests would get lost in the noise.

i think of this more like a 'views hacks' external - because while views handles (for example) "tables," why shouldn't it also just own "flipped tables"? similar for five star...

Demoshane’s picture

I agree with zilla. I just dont see this module as a part of either but as an extension instead. This also to diversify and to reduce bloat.

zilla’s picture

btw, how is search api currently calculating five star ratings? when i view the 'add fields' option within the index and search api settings, i DO see already the ability to add in my field name that represents the voting/fivestar - but i'm unclear about what it is gathering from the field.

in basic terms, when you say "won't index correctly" i'm just trying to understand what it is that searchapi does with fivestar "out of the box"

Demoshane’s picture

The current way plain doesn't work. The logic does automatically detect the fields (like any other fields) but the indexing logic is not there. This is where this module comes in (Search API does detection but doesn't do any special logic behind the scenes and it's not supposed to do either)

zilla’s picture

do you mean that it can not expose, for example, a 'facet' that will allow for sorting by fivestar ranking in any way?

Demoshane’s picture

Basically it retrieves all fields as blanks resulting everything being 0.

zilla’s picture

yup, just realized that when i tried to use it in the index and expose as a facet with search api...in fact, even after reindexing the block will not show up (likely because it is generating zero results across the board with a slew of zeros!)

Demoshane’s picture

It's just that the Search API cannot and is not expected to have out of the box support for everything. That would be just impossible (in addition to generating lots of bloat if you don't need everything / causing performance hits).

zilla’s picture

i know, it's maddening - it appropriately picks up the named field that uses fivestar and then basically does nothing with it!

zilla’s picture

bump: what will it take at this point - October 2nd 2013- to move this to a project page with a dev and a beta release?

zilla’s picture

note: should this be merged with Apache Solr Voting API? and then this would extend to search api?
https://drupal.org/project/apachesolr_votingapi

kscheirer’s picture

No further action is required, but the best thing you can do is get a Review Bonus by reviewing other applications. That will get you to the top of the list of projects to get reviewed (and hopefully approved). Only manual reviews count, just using http://pareview.sh is not enough.

----
Top Shelf Modules - Crafted, Curated, Contributed.

kscheirer’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

It's been a month without any problems reported, so I'm promoting this myself as per https://drupal.org/node/1125818.

Thanks for your contribution, Demoshane!

I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

----
Top Shelf Modules - Crafted, Curated, Contributed.

zilla’s picture

congratulations demoshane! now we get to hammer your issue queue with requests ;)

Demoshane’s picture

Thank you both.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.