Generated from protobuf message google.cloud.retail.v2.Rating
Namespace
Google \ Cloud \ Retail \ V2
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ rating_count
int
The total number of ratings. This value is independent of the value of rating_histogram. This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is returned.
↳ average_rating
float
The average rating of the Product. The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is returned.
↳ rating_histogram
array
List of rating counts per rating value (index = rating - 1). The list is empty if there is no rating. If the list is non-empty, its size is always 5. Otherwise, an INVALID_ARGUMENT error is returned. For example, [41, 14, 13, 47, 303]. It means that the Product got 41 ratings with 1 star, 14 ratings with 2 star, and so on.
getRatingCount
The total number of ratings. This value is independent of the value of
rating_histogram.
This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
returned.
Returns
Type
Description
int
setRatingCount
The total number of ratings. This value is independent of the value of
rating_histogram.
This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
returned.
The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is
returned.
Parameter
Name
Description
var
float
Returns
Type
Description
$this
getRatingHistogram
List of rating counts per rating value (index = rating - 1). The list is
empty if there is no rating. If the list is non-empty, its size is
always 5. Otherwise, an INVALID_ARGUMENT error is returned.
For example, [41, 14, 13, 47, 303]. It means that the
Product got 41 ratings with 1 star, 14
ratings with 2 star, and so on.
List of rating counts per rating value (index = rating - 1). The list is
empty if there is no rating. If the list is non-empty, its size is
always 5. Otherwise, an INVALID_ARGUMENT error is returned.
For example, [41, 14, 13, 47, 303]. It means that the
Product got 41 ratings with 1 star, 14
ratings with 2 star, and so on.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Cloud Retail V2 Client - Class Rating (2.3.1)\n\nVersion latestkeyboard_arrow_down\n\n- [2.3.1 (latest)](/php/docs/reference/cloud-retail/latest/V2.Rating)\n- [2.3.0](/php/docs/reference/cloud-retail/2.3.0/V2.Rating)\n- [2.2.1](/php/docs/reference/cloud-retail/2.2.1/V2.Rating)\n- [2.1.3](/php/docs/reference/cloud-retail/2.1.3/V2.Rating)\n- [2.0.0](/php/docs/reference/cloud-retail/2.0.0/V2.Rating)\n- [1.7.0](/php/docs/reference/cloud-retail/1.7.0/V2.Rating)\n- [1.6.4](/php/docs/reference/cloud-retail/1.6.4/V2.Rating)\n- [1.5.0](/php/docs/reference/cloud-retail/1.5.0/V2.Rating)\n- [1.4.2](/php/docs/reference/cloud-retail/1.4.2/V2.Rating)\n- [1.3.1](/php/docs/reference/cloud-retail/1.3.1/V2.Rating)\n- [1.2.1](/php/docs/reference/cloud-retail/1.2.1/V2.Rating)\n- [1.1.1](/php/docs/reference/cloud-retail/1.1.1/V2.Rating)\n- [1.0.1](/php/docs/reference/cloud-retail/1.0.1/V2.Rating) \nReference documentation and code samples for the Google Cloud Retail V2 Client class Rating.\n\nThe rating of a [Product](/php/docs/reference/cloud-retail/latest/V2.Product).\n\nGenerated from protobuf message `google.cloud.retail.v2.Rating`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Retail \\\\ V2\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getRatingCount\n\nThe total number of ratings. This value is independent of the value of\n[rating_histogram](/php/docs/reference/cloud-retail/latest/V2.Rating#_Google_Cloud_Retail_V2_Rating__getRatingHistogram__).\n\nThis value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is\nreturned.\n\n### setRatingCount\n\nThe total number of ratings. This value is independent of the value of\n[rating_histogram](/php/docs/reference/cloud-retail/latest/V2.Rating#_Google_Cloud_Retail_V2_Rating__getRatingHistogram__).\n\nThis value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is\nreturned.\n\n### getAverageRating\n\nThe average rating of the [Product](/php/docs/reference/cloud-retail/latest/V2.Product).\n\nThe rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is\nreturned.\n\n### setAverageRating\n\nThe average rating of the [Product](/php/docs/reference/cloud-retail/latest/V2.Product).\n\nThe rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is\nreturned.\n\n### getRatingHistogram\n\nList of rating counts per rating value (index = rating - 1). The list is\nempty if there is no rating. If the list is non-empty, its size is\nalways 5. Otherwise, an INVALID_ARGUMENT error is returned.\n\nFor example, \\[41, 14, 13, 47, 303\\]. It means that the\n[Product](/php/docs/reference/cloud-retail/latest/V2.Product) got 41 ratings with 1 star, 14\nratings with 2 star, and so on.\n\n### setRatingHistogram\n\nList of rating counts per rating value (index = rating - 1). The list is\nempty if there is no rating. If the list is non-empty, its size is\nalways 5. Otherwise, an INVALID_ARGUMENT error is returned.\n\nFor example, \\[41, 14, 13, 47, 303\\]. It means that the\n[Product](/php/docs/reference/cloud-retail/latest/V2.Product) got 41 ratings with 1 star, 14\nratings with 2 star, and so on."]]