Reputation: 3650
I've been using Google cloud product search api for 6 months now and the maximum products I could get in a response was 10(which I think is default).
But I want to scale up my system, thus want more products in the productSearch API response. I tried finding out the limits and way to change the returned number of products, couldn't find any in the official documentation (https://cloud.google.com/vision/product-search/docs/searching#product-search-get-similar-products-go).
It would be great if I could get some help here.
Thanks
Upvotes: 0
Views: 960
Reputation: 140
Disclaimer: I've checked this on the golang client, but I think the same shall apply to other languages (clients are all autogenerated anyways).
At the moment of writing this comment it is not possible to specify maxResults if you are using the official method of the official go client.
Though, if you look at the implementation of said official method, you'll see that behind the scenes there is actually a maxResults parameter (which is set to 0, eg: "use server default", I assume) and it is trivial to write your own method with exposed maxResults or just use the underlying implementation:
Just use an exported method AnnotateImage directly or write your own small wrapper around it.
One thing to be aware of: according to the documentation https://cloud.google.com/vision/product-search/docs/general-tips#search-results
The maximum number of results returned will vary from query to query due to implementation details. The maximum guaranteed amount of results returned is 500. If more are requested, the requested number may not be met.
I so far never got that "max" results and as the topic starter I always get max 10, unless I override the implementation.
Upvotes: 1
Reputation: 1060
ProductSearchParams is where you would specify parameters when doing a search in ProductSearch. There is no way for you to control how many results are returned when searching.
The ProductSearch api provides you with the N best matches, so even as you scale up to an extremely large product set, it will still return the top results.
Upvotes: 1
Reputation: 776
You can check the Quotas and Limits of Cloud Vision API Product Search on the documentation.
In case you want to increase the quotas, and based on the documentation, you should select "EDIT QUOTAS" from the Quotas Page. Once you do the request, it will be reviewed and you will be notified either has been approved or denied.
About the limit you are interested in, I found this GitHub repository where you can find the vision-api.json with the specified parameters:
"parameters": {
"pageSize": {
"description": "The maximum number of items to return. Default 10, maximum 100.",
Hope this was what you were looking for!
Upvotes: 1