All Products
Search
Document Center

Image Search:Filter condition

Last Updated:Jun 20, 2026

In Image Search, use a filter condition to return only images that match your criteria. For example, you can return images where the ownerId is 1000 or the company name is 'alibaba'.

Field settings

When you add an image, you can set eight attribute fields: IntAttr, IntAttr2, IntAttr3, IntAttr4, StrAttr, StrAttr2, StrAttr3, and StrAttr4. These consist of four integer attributes and four string attributes for filtering images during a search. Image Search supports multiple methods for adding images. The following examples demonstrate how to set these attributes for each method.

  • Add images using batch operations. For more information, see Batch operations.

    {"OperationType": "ADD","ProductId": "1000","CategoryId": 0,"IntAttr": 123,"IntAttr2": 135,"StrAttr": "value1","StrAttr2": "value2","IntAttr3": 3,"StrAttr4": "value4","CustomContent": "k1:v1,k2:v2,k3:v3","PicName": "girl_cloth1.jpg"}
  • Add images using the SDK. For more information, see the Add API.

  • Add images using the console.

    On the Add Image page in the console, you can set values for the IntAttr, IntAttr2, IntAttr3, IntAttr4, StrAttr, StrAttr2, StrAttr3, and StrAttr4 attributes. On this page, fill in the following fields: Product ID (for example, 1), Image Name (for example, 1.jpg), and Upload Image. Enable the Object Detection switch, and set the Object Detection Mode to Auto. Then, specify the Image Category, Custom Content, Integer Attribute (for example, 1000), String Attribute (for example, str2345), Integer Attribute 2 (for example, 200), and String Attribute 2 (for example, str9999). When finished, click Confirm. A successful response returns a JSON object where the code field is 0, the message field is success, and the statusCode field is 200. The response also includes the categoryId and region in the picInfo object.

Field filtering

When searching, specify a filter condition to refine the results. You can combine multiple conditions using the AND or OR logical operators.

  • The following operators are supported for int_attr, int_attr2, int_attr3, and int_attr4:

    • >

    • >=

    • <

    • <=

    • =

    • in

    • not in

  • The following operators are supported for str_attr, str_attr2, str_attr3, and str_attr4:

    • =

    • !=

    • in

    • not in

Examples:

int_attr>=100
str_attr!="value1"
int_attr=1000 AND str_attr="value1"
int_attr = 1000 AND  int_attr2 = 200 AND str_attr = "str2345" AND str_attr2="str9999"
  • Search using an API. For more information, see Request parameters.

    Set the filter parameter in your API request to the desired filter condition.

  • Search using an SDK. For more information, see the SearchImageByPic API.

    Call the setFilterClause method of the SearchItemRequest class to set the filter condition.

  • Search using the console.

    Set the Filter condition based on the preceding examples. On the Image Search tab, select SearchByPic as the search type, upload the image to search with, and enable object detection (detection mode: Auto). Set the number of results to 10 and the starting position to 0. In the Filter condition input box, enter your filter expression, for example, int_attr = 1000 AND int_attr2 = 200 AND str_attr = "str2345" AND str_attr2 = "str9999". Click Confirm. If the returned JSON result shows that docsFound and docsReturn are both 1, and the field values of the matched record (int_attr:1000, int_attr2:200, str_attr:"str2345", str_attr2:"str9999") match the filter condition, it confirms that field filtering is working correctly.