VuFind API Documentation

RatingsServiceInterface extends DbServiceInterface

Database service interface for Ratings.

Tags
category

VuFind

author

Sudharma Kellampalli skellamp@villanova.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Wiki

Table of Contents

addOrUpdateRating()  : int
Add or update user's rating for a resource.
deleteByUser()  : void
Deletes all ratings by a user.
getCountsForRecord()  : array<string|int, mixed>
Get rating breakdown for the specified record.
getRecordRatings()  : array<string|int, mixed>
Get average rating and rating count associated with the specified record.
getStatistics()  : array<string|int, mixed>
Get statistics on use of Ratings.
persistEntity()  : void
Persist an entity.

Methods

getCountsForRecord()

Get rating breakdown for the specified record.

public getCountsForRecord(string $id, string $source, array<string|int, mixed> $groups) : array<string|int, mixed>
Parameters
$id : string

Record ID to look up

$source : string

Source of record to look up

$groups : array<string|int, mixed>

Group definition (key => [min, max])

Return values
array<string|int, mixed>

Array with keys count and rating (between 0 and 100) as well as an groups array with ratings from lowest to highest

getRecordRatings()

Get average rating and rating count associated with the specified record.

public getRecordRatings(string $id, string $source, int|null $userId) : array<string|int, mixed>
Parameters
$id : string

Record ID to look up

$source : string

Source of record to look up

$userId : int|null

User ID, or null for all users

Return values
array<string|int, mixed>

Array with keys count and rating (between 0 and 100)

getStatistics()

Get statistics on use of Ratings.

public getStatistics() : array<string|int, mixed>
Return values
array<string|int, mixed>

Search results