Cette rubrique décrit la syntaxe et les exemples de SearchImageByText, qui permet de rechercher des informations d'image dans une instance Image Search à partir de texte.
Description de l'opération
Description de l'opération.
Testez maintenant
Testez cette API dans OpenAPI Explorer, sans signature manuelle. Les appels réussis génèrent automatiquement du code SDK correspondant à vos paramètres. Téléchargez-le avec une sécurité intégrée des identifiants pour une utilisation locale. Testez cette API dans OpenAPI Explorer, sans signature manuelle. Les appels réussis génèrent automatiquement du code SDK correspondant à vos paramètres. Téléchargez-le avec une sécurité intégrée des identifiants pour une utilisation locale.
Test
Autorisation RAM
|
imagesearch:SearchImageByText |
get |
*All Resource
|
Aucune | Aucune |
Paramètres de requête
|
Paramètre |
Type |
Requis |
Description |
Exemple |
| InstanceName |
string |
Oui |
Le nom de l'instance Image Search. Le nom peut comporter jusqu'à 20 caractères. Si vous avez acheté une instance Image Search, connectez-vous à la console Image Search pour consulter le nom de l'instance. Si vous n'avez pas acheté d'instance Image Search, consultez Activer le service et Créer une instance. Remarque
Le nom de l'instance n'est pas l'identifiant de l'instance. Veillez à bien les distinguer. |
demoinstance1 |
| Num |
integer |
Non |
Le nombre de résultats à renvoyer. Valeurs valides : 1 à 100. Valeur par défaut : 10. |
10 |
| Start |
integer |
Non |
La position de départ des résultats à renvoyer. Valeurs valides : 0 à 499. Valeur par défaut : 0. |
0 |
| Filter |
string |
Non |
La condition de filtrage. Le champ int_attr prend en charge les opérateurs suivants : in, not in, supérieur à (>), supérieur ou égal à (>=), inférieur à (<), inférieur ou égal à (<=) et égal à (=). Le champ str_attr prend en charge les opérateurs suivants : in, not in, égal à (=) et différent de (!=). Vous pouvez utiliser AND et OR pour combiner plusieurs conditions. Exemples :
Remarque
La condition de filtrage peut comporter jusqu'à 4 096 caractères. |
int_attr=1000 AND str_attr="value1" |
| DistinctProductId |
boolean |
Non |
Si ce paramètre est défini sur true, les données en double sont supprimées en fonction du champ ProductId lors de la recherche. |
false |
| Text |
string |
Oui |
Le texte de description pour la recherche d'images. Le chinois et l'anglais sont pris en charge. Remarque
Le texte peut comporter jusqu'à 512 caractères. |
xxxx |
| ScoreThreshold |
string |
Non |
Le seuil de score de similarité. Une fois ce paramètre spécifié, seules les images dont les scores de similarité sont supérieurs ou égaux au seuil sont renvoyées. Valeurs valides : 0,00 à 1,00. La valeur prend en charge jusqu'à deux décimales. Valeur par défaut : 0,00. |
0.50 |
Éléments de réponse
|
Élément |
Type |
Description |
Exemple |
|
object |
Les paramètres de réponse. |
||
| Msg |
string |
Le message d'erreur. |
success |
| Head |
object |
La vue d'ensemble des résultats de recherche. |
|
| DocsFound |
integer |
Le nombre de résultats renvoyés. |
10 |
| DocsReturn |
integer |
Le nombre de résultats correspondants dans l'instance. |
10000 |
| SearchTime |
integer |
Le temps consommé par la recherche, en millisecondes. |
95 |
| RequestId |
string |
L'identifiant de la requête. |
B3137727-7D6E-488C-BA21-0E034C38A879 |
| Auctions |
array<object> |
Les informations de description de tous les produits renvoyés. |
|
|
object |
Les informations de description de tous les produits renvoyés. |
||
| ProductId |
string |
L'identifiant du produit. |
2092061_1 |
| PicName |
string |
Le nom de l'image. |
2092061_1.jpg |
| CategoryId |
integer |
La catégorie de l'image. |
8888888 |
| CustomContent |
string |
Le contenu personnalisé défini par l'utilisateur. |
zidingyi |
| Score |
number |
Le score de similarité de l'image. Valeurs valides : 0 à 1.\n> Vous devez mettre à niveau le SDK vers la version V3.1.1 pour utiliser cette fonctionnalité. |
1 |
| IntAttr |
integer |
L'attribut de type entier. |
2 |
| IntAttr2 |
integer |
L'attribut de type entier. |
2 |
| StrAttr2 |
string |
L'attribut de type chaîne. |
xxxx |
| StrAttr |
string |
L'attribut de type chaîne. |
xxxx |
| StrAttr3 |
string |
L'attribut de type chaîne. |
xxxx |
| StrAttr4 |
string |
L'attribut de type chaîne. |
xxxx |
| IntAttr3 |
integer |
L'attribut de type entier. |
2 |
| IntAttr4 |
integer |
L'attribut de type entier. |
2 |
| Code |
integer |
Le code d'erreur. Valeurs valides : |
0 |
| PicInfo |
object |
Les informations de catégorie. |
|
| AllCategories |
array<object> |
Toutes les catégories prises en charge par le système. |
|
|
object |
Toutes les catégories prises en charge par le système. |
||
| Name |
string |
The category name. |
other |
| Id |
integer |
The category ID. |
88888888 |
| Success |
boolean |
Indique si la requête a réussi. |
true |
| AccessDeniedDetail |
object |
Les détails du refus d'accès. |
|
| AuthAction |
string |
L'action pour la requête d'authentification. |
xxx |
| AuthPrincipalDisplayName |
string |
Le nom d'affichage du principal d'authentification. |
111 |
| AuthPrincipalOwnerId |
string |
L'identifiant du compte Alibaba Cloud du principal d'authentification. |
222 |
| AuthPrincipalType |
string |
Le type du principal d'authentification. |
SubUser |
| EncodedDiagnosticMessage |
string |
Le message de diagnostic complet encodé. |
xxxxxx |
| NoPermissionType |
string |
Valeurs valides :
|
ImplicitDeny |
| PolicyType |
string |
Le type de stratégie qui a provoqué le refus d'accès. |
PauseNotify |
Exemples
JSON format
{
"Msg": "success",
"Head": {
"DocsFound": 10,
"DocsReturn": 10000,
"SearchTime": 95
},
"RequestId": "B3137727-7D6E-488C-BA21-0E034C38A879",
"Auctions": [
{
"ProductId": "2092061_1",
"PicName": "2092061_1.jpg",
"CategoryId": 8888888,
"CustomContent": "zidingyi",
"Score": 1,
"IntAttr": 2,
"IntAttr2": 2,
"StrAttr2": "xxxx",
"StrAttr": "xxxx",
"StrAttr3": "xxxx",
"StrAttr4": "xxxx",
"IntAttr3": 2,
"IntAttr4": 2
}
],
"Code": 0,
"PicInfo": {
"AllCategories": [
{
"Name": "other",
"Id": 88888888
}
]
},
"Success": true,
"AccessDeniedDetail": {
"AuthAction": "xxx",
"AuthPrincipalDisplayName": "111",
"AuthPrincipalOwnerId": "222",
"AuthPrincipalType": "SubUser",
"EncodedDiagnosticMessage": "xxxxxx",
"NoPermissionType": "ImplicitDeny",
"PolicyType": "PauseNotify"
}
}
Codes d'erreur
|
Code de statut HTTP |
Code d'erreur |
Message d'erreur |
Description |
|---|---|---|---|
| 400 | BadRequest | The request has invalid parameters. | |
| 400 | InstanceStatusError | Your instance is unavailable. | |
| 400 | TimeoutForTransferImage | Timeout after 5 seconds waiting for images transfer to complete. | |
| 400 | InvalidInstance | The specified instance name is invalid. | |
| 400 | NoCaretSeperator | The body content is missing the ^ separator. | |
| 400 | EmptyMeta | The body content has an empty meta field. | |
| 400 | InvalidMetaItem | The meta field is invalid. | |
| 400 | NoPicList | The body content is missing the pic_list parameter. | |
| 400 | InvalidPicList | The specified pic_list parameter is invalid. | |
| 400 | NoSpecifiedPic | he content of an image is not specified in the HTTP POST body. | |
| 400 | NoSpecifiedSearchPic | The search image is not specified. | |
| 400 | OverflowMaxResultNum | The specified number of total results exceeds the maximum of 500. | |
| 400 | OverflowMaxReturnNum | The specified number of results for each request exceeds the maximum of 100. | |
| 400 | InvalidStartParameter | The specified parameter start is inavlid. | |
| 400 | InvalidNumParameter | The specified parameter num is invalid. | |
| 400 | NoSpecifiedAddPic | The image to insert is not specified. | |
| 400 | NoSpecifiedItemId | The item_id parameter is not specified. | |
| 400 | InvalidIntAttr | The specified int_attr field is invalid. | |
| 400 | InvalidFilterClause | The specified filtering condition is invalid. | |
| 400 | InstanceOverQuota | The number of items exceeds the limit. | |
| 400 | IncorrectOrientation | The image contains incorrect rotation flags in the meta data. | |
| 400 | UnsupportedPicPixels | The specified pixels is not supported. | |
| 400 | SearchTimeout | The request is timed out. | |
| 400 | PicNotExist | The search picture does not exist. | |
| 400 | NoSpecifiedProductId | The parameter ProductId no specified. | |
| 400 | NoSpecifiedPicName | The parameter PicName no specified. | |
| 400 | NoSpecifiedPicContent | The parameter PicContent no specified. | |
| 400 | InvalidType | The specified parameter Type is not valid. | |
| 400 | InvalidProductId | The specified parameter ProductId is not valid. | |
| 400 | InvalidPicName | The specified parameter PicName is not valid. | |
| 400 | InvalidStrAttr | The specified parameter StrAttr is not valid. | Invalid StrAttr |
| 400 | InvalidCustomContent | The specified parameter CustomContent is not valid. | |
| 400 | InvalidPicContent | The specified parameter PicContent length greater than 4 * 1024 * 1024. | |
| 400 | InvalidPicUrl | The search picture does not exist at the specific url. | |
| 400 | InvalidInstanceName | The parameter instanceName is not specified. | |
| 400 | InvalidRequestId | The parameter requestId is not specified. | |
| 400 | InvalidRequestIdTooLarge | The parameter requestId is too large. | |
| 400 | InvalidRegion | The specific region is illegal | |
| 400 | InvalidIntAttr4 | The specified parameter IntAttr4 is not valid. | Invalid |
| 400 | InvalidIntAttr3 | The specified parameter IntAttr3 is not valid. | Invalid IntAttr3 |
| 400 | InvalidIntAttr2 | The specified parameter IntAttr2 is not valid. | Invalid IntAttr2 |
| 400 | InvalidStrAttr4 | The specified parameter StrAttr4 is not valid. | Invalid StrAttr4 |
| 400 | InvalidStrAttr3 | The specified parameter StrAttr3 is not valid. | Invalid StrAttr3 |
| 400 | InvalidStrAttr2 | The specified parameter StrAttr2 is not valid. | Invalid |
| 400 | InvalidText | The specified parameter Text is not valid. | Description Text cannot be null |
| 400 | InvalidTextLength | Invalid text clause. | The text field length must be within 512. |
| 400 | UnsupportedOperationType | The specified action is not supported. | |
| 400 | UnsupportedInstanceType | The instance type is not supported. | |
| 500 | UnknownException | An internal server error occurred. | |
| 500 | NetworkException | A network error occurred. | |
| 500 | RequestTimeout | The request is timeout. | |
| 500 | ExtractFeatureTimeout | The request was timed out while extracting features. | |
| 500 | AccessEngineFailed | An error occurred while accessing the search engine. | |
| 500 | InternalOssError | An internal OAS error occurred. | |
| 500 | InternalSwiftError | An internal SWIFT error occurred. | |
| 500 | InternalTableStoreError | An internal Table Store error occurred. | |
| 500 | ConnectionDVException | Failed to obtain collection. | internalError |
| 403 | NoPermission | You are not authorized to perform this operation. | |
| 403 | DeniedRequest | Your request was denied due to instance flow control. |
Consultez Codes d'erreur pour la liste complète.
Notes de version
Consultez Notes de version pour la liste complète.