Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Instant Search

Method Objective

The method requests products that match the search query. The method must be called for each entered character of the search query. The search for products starts from the second entered symbol.

Syntax and parameters

Code Block
languagejava
themeFadeToGrey
PersonaClick.search(search_query, type, params, callback);

NameTypeRequirementDescription
search_querystringrequiredThe search query text.
typeenumrequiredSearch Type. See the example below.
paramsenumrequiredRequest parameters. See the description below.
callbackfunctionrequiredCallback-function, where the API response will be passed to. 

Request parameters

NameTypeRequirementDescription
LOCATIONSstringoptionallyString with location IDs separated by comma. If used, the API response will return products available in the listed locations.

API response

Name
Type
Description
productsarray

An array of objects with product information. Each object has the following properties:

id – product ID
  • barcode – product barcode, if it was imported in the product catalog (type: string)
name
  • brand – product
name
  • vendor (type: string)
url – product page link
  • categories – an Object array with details of the product category hierarchy, where each object has properties:
    "id" – category ID (type: string)
picture – link to the product image
  • "level" – сategory level in the
PersonaClick image repository
  • hierarchy (type: string)
price – product price
  • "name" – category name (type:
number
  • string)
old_price – product old price
  • "name_with_parent" – string name from the name of the parent and main product categories, separated by a "-" (type: string
, default – 0
  • )
currency – product currency
  • "parent_id" – parent category ID (type: string)
    "url" – category page url (type: string)
  • category_ids – an array of IDs of the product category hierarchy (type: String array)
  • currency – product currency (type: string, matches the currency of the PersonaClick account, or the user value set in the settings of the
PersonaClick account
  • PersonaClick account)
price_formatted – formatted product price including currency
  • discount – the percentage difference between the old price and the current price (type:
string
Note

If no links are specified for categories in the product feed, the API will return an empty array for this property.

queriesarrayAn array of objects with relevant popular queries. Each object has the following properties:
name – relevant search query
  • number)
products_totalnumberThe total number of products that match the search query.search_querystringThe search query text.categoriesarray

An array of objects with information about the categories matching the search query. Each object has the following properties:

  • id – category ID (type: string)
  • name – category name (type: string)
  • url – category page link (type: string)

API response

NameTypeDescriptionhtmlstringHTML code of the widget with full search results. Widget template is customizable in PersonaClick account.productsarray

An array of objects with product information. Each object has the following properties:

  • barcode – product barcode, if it was imported in the product catalog. The value will be available only if using the "extended" parameter in the API request (type: string)
  • brand – product vendor (type: string)
  • categories – an Object array with details of the product category hierarchy, where each object has properties:
    "id" – category ID (type: string)
    "level" – сategory level in the hierarchy (type: string)
    "name" – category name (type: string)
    "name_with_parent" – string name from the name of the parent and main product categories, separated by a "-" (type: string)
    "parent_id" – parent category ID (type: string)
    "url" – category page url (type: string)
  • category_ids – an array of IDs of the product category hierarchy (type: String array)
  • currency – product currency (type: string, matches the currency of the PersonaClick account, or the user value set in the settings of the PersonaClick account)
  • discount – the percentage difference between the old price and the current price (type: number)
  • discount_formatted – the percentage difference between the old and the current price that is formatted as a string with the "%" symbol (type: string)
  • id – product ID (type: string)
  • image_url – URL of the original product image (type: string)
  • image_url_handle – relative URL of the original product image (type: string)
  • image_url_resized – the object with the URLs of the resize product image. Available object keys matching the size of the image in pixels: 120, 140, 160, 180, 200, 220, 310, 520 (type: object)
  • is_new – new arrival product (type: boolean). See the parameter in the product catalog import (XML, HTTP API)
  • leftovers – rough number of the products left in stock. Available values are: 
    "one" - one product
    "few" - 2-10 products
    "lot" - over 10 products
  • model –  model and product name (type: string)
  • name – product name (type: string)
  • oldprice – integer old price of the product (type: number)
  • oldprice_formatted – formatted integer old price of the product, including currency (type: string)
  • oldprice_full – old price of the product (type: number)
  • oldprice_full_formatted – formatted old price of the product, including currency (type: string)
  • params – object array with pairs of "key" (type: string), "values" (type: array) properties. The data matches the values of the "param" parameter of the product feed/catalog (XML, HTTP API). The value will be available only if using the "extended" parameter in the API request.
  • picture – link to the product image in the PersonaClick image repository (type: string)
  • price – integer current price of the product (type: number)
  • price_formatted – formatted integer current price of the product, including currency (type: string)
  • price_full – current price of the product (type: number)
  • price_full_formatted – formatted current price of the product, including currency (type: string)
  • rating – product rating (type: number)
  • relative_sales_rate – level of sales of current product ( in percentage) in relation to the maximum level of sales of products in the store (type: number)
  • sales_rate – level of product sales (absolute value) (type: number)
  • url – product page URL (type: string)
  • url_handle - relative product page URL (type: string)
products_totalnumberThe total number of products that match the search query. The following query parameters do not affect this value: page, limit, and offset.search_querystringThe search query text.book_authorsarrayReserved.categoriesarrayReserved.collectionsarrayReserved.keywordsarrayReserved.queriesarrayReserved.virtual_categoriesarrayReserved.
  • discount_formatted – the percentage difference between the old and the current price that is formatted as a string with the "%" symbol (type: string)
  • discount_percent – user-defined discount value (type: number)
  • gift – specifies whether the product is a gift (type: boolean)
  • group_id – product group ID (type: string)
  • installment – the payment cost if purchasing the product in installments (type: number)
  • id – product ID (type: string)
  • image_url – URL of the original product image (type: string)
  • image_url_handle – relative URL of the original product image (type: string)
  • url – link to a full search page (the format of the link is configured in the PersonaClick account)
  • book_authorsarrayReserved.collectionsarrayReserved.keywordsarrayReserved.virtual_categoriesarrayReserved.

    Example of use

    Code Block
    languagejava
    themeFadeToGrey
    SearchParams params = new SearchParams();
    params.put(SearchParams.Parameter.LOCATIONS, "NY,LA");
    PersonaClick.search("To be or not to be", SearchParams.TYPE.INSTANT, params, new Api.OnApiCallbackListener() {
        @Override
        public void onSuccess(JSONObject response) {
            // features showing instant search widget
        }
    });

    Full Search

    Method Objective

    The method requests products that match the full search query and is used to display the search results.

    Syntax and parameters

    Code Block
    languagejava
    themeFadeToGrey
    PersonaClick.search(search_query, type, params, callback);
    NameTypeRequirementDescriptionsearch_querystringrequiredThe search query text.typeenumrequiredSearch Type. See the example below.paramsenumrequiredRequest parameters. See the description below.callbackfunctionrequiredCallback-function, where the API response will be passed to. 

    Request Parameters

    NameTypeRequirementDescriptionLIMITstringoptionallyThe maximum number of products in the API response.PAGEstringoptionallyPage number (first page - 1, by default - 1).BRANDSstringoptionallyString with vendor names separated by comma. If used, the API response will return only the products of the listed vendors. The vendors must be listed in the product feed.COLORSstringoptionallyString with color names separated by comma. If used, the API response will return the products of the listed colors. The colors of the product should be specified in the product feed.PRICE_MINstringoptionallyMinimum product price in API response.PRICE_MAXstringoptionallyMaximum product price in API response.LOCATIONSstringoptionallyString with location IDs separated by comma. If used, the API response will return products available in the listed locations.CATEGORIESstringoptionallyString with category IDs separated by comma. If used, the API response will return only those products that are in the specified categories.SORT_BYstringoptionallySorting products in the API response.
    Available values:
    • popular - sorting products by popularity (by default
    • price - sorting by product price
    • discount - sorting by discount (the difference between oldprice and price in the product feed)
    SORT_DIRstringoptionally

    Sorting directions for the sort_by parameter.
    Available values:

    • asc - ascending sorting
    • desc - downwards sorting (by default)
    FILTERSstringoptionallyAdditional request filters. See the example below.
    • image_url_resized – the object with the URLs of the resize product image. Available object keys matching the size of the image in pixels: 120, 140, 160, 180, 200, 220, 310, 520 (type: object)
    • is_new – new arrival product (type: boolean). See the parameter in the product catalog import (XML, HTTP API)
    • leftovers – rough number of the products left in stock. Available values are: 
      "one" - one product
      "few" - 2-10 products
      "lot" - over 10 products
    • model –  model and product name (type: string)
    • name – product name (type: string)
    • oldprice – integer old price of the product (type: number)
    • oldprice_formatted – formatted integer old price of the product, including currency (type: string)
    • oldprice_full – old price of the product (type: number)
    • oldprice_full_formatted – formatted old price of the product, including currency (type: string)
    • params – object array with pairs of "key" (type: string), "values" (type: array) properties. The data matches the values of the "param" parameter of the product feed/catalog (XML, HTTP API).
    • picture – link to the product image in the PersonaClick image repository (type: string)
    • price – integer current price of the product (type: number)
    • price_formatted – formatted integer current price of the product, including currency (type: string)
    • price_full – current price of the product (type: number)
    • price_full_formatted – formatted current price of the product, including currency (type: string)
    • price_with_promocode – the product price when using the promo code specified for the product (type: number)
    • price_with_promocode_formatted – formatted product price when using the promo code specified for the product, including currency (type: string)
    • promocode – the promo code is for a specific product (type: string)
    • rating – product rating (type: number)
    • relative_sales_rate – level of sales of current product ( in percentage) in relation to the maximum level of sales of products in the store (type: number)
    • sales_rate – level of product sales (absolute value) (type: number)
    • url – product page URL (type: string)
    • url_handle - relative product page URL (type: string)
    products_totalnumberThe total number of products that match the search query.
    search_querystringThe search query text.
    categoriesarray

    An array of objects with information about the categories matching the search query. Each object has the following properties:

    • id – category ID (type: string)
    • name – category name (type: string)
    • url – category page link (type: string)
    • parent – parent category ID (type: string)
    • alias – wordy category identifier (type: string)

    If no links are specified for categories in the product feed, the API will return an empty array for this property.

    queriesarrayAn array of objects with relevant popular queries. Each object has the following properties:
    • name – relevant search query (type: string)
    • url – link to a full search page (the format of the link is configured in the PersonaClick account)
    htmlstringContains a rendered custom HTML template for the Instant Search widget, or null if the HTML template is empty or the default one is used.
    search_query_redirectsobject

    The object will be available if a redirect is created for the search query: Account -> Search -> Search redirect

    The object contains the following properties:

    • deep_link (type: string)
    • query (type: string)
    • redirect_link (type: string)

    Example of use

    Code Block
    languagejava
    themeFadeToGrey
    SearchParams params = new SearchParams();
    params.put(SearchParams.Parameter.LOCATIONS, "NY,LA");
    PersonaClick.search("To be or not to be", SearchParams.TYPE.INSTANT, params, new Api.OnApiCallbackListener() {
        @Override
        public void onSuccess(JSONObject response) {
            // features showing instant search widget
        }
    });



    Full Search

    Method Objective

    The method requests products that match the full search query and is used to display the search results.

    Syntax and parameters

    Code Block
    languagejava
    themeFadeToGrey
    PersonaClick.search(search_query, type, params, callback);

    NameTypeRequirementDescription
    search_querystringrequiredThe search query text.
    typeenumrequiredSearch Type. See the example below.
    paramsenumrequiredRequest parameters. See the description below.
    callbackfunctionrequiredCallback-function, where the API response will be passed to. 

    Request Parameters

    NameTypeRequirementDescription
    LIMITstringoptionallyThe maximum number of products in the API response (by default - 10).
    PAGEstringoptionallyPage number (first page - 1, by default - 1).
    BRANDSstringoptionallyString with vendor names separated by comma. If used, the API response will return only the products of the listed vendors. The vendors must be listed in the product feed.
    COLORSstringoptionallyString with color names separated by comma. If used, the API response will return the products of the listed colors. The colors of the product should be specified in the product feed.
    FASHION_SIZESstringoptionallyString with fashion sizes values separated by comma. If used, the API response will return the products of the listed sizes. The sizes of the product should be specified in the product feed.
    PRICE_MINstringoptionallyMinimum product price in API response.
    PRICE_MAXstringoptionallyMaximum product price in API response.
    LOCATIONSstringoptionallyString with location IDs separated by comma. If used, the API response will return products available in the listed locations.
    CATEGORIESstringoptionallyString with category IDs separated by comma. If used, the API response will return only those products that are in the specified categories.
    SORT_BYstringoptionallySorting products in the API response.
    Available values:
    • popular - sorting products by popularity (by default
    • price - sorting by product price
    • discount - sorting by discount (the difference between oldprice and price in the product feed)
    SORT_DIRstringoptionally

    Sorting directions for the sort_by parameter.
    Available values:

    • asc - ascending sorting
    • desc - downwards sorting (by default)
    FILTERSstringoptionallyAdditional request filters. See the example below.

    API response

    NameTypeDescription
    htmlstringHTML code of the widget with full search results. Widget template is customizable in PersonaClick account.
    productsarray

    An array of objects with product information. Each object has the following properties:

    • barcode – product barcode, if it was imported in the product catalog (type: string)
    • brand – product vendor (type: string)
    • categories – an Object array with details of the product category hierarchy, where each object has properties:
      "id" – category ID (type: string)
      "level" – сategory level in the hierarchy (type: string)
      "name" – category name (type: string)
      "name_with_parent" – string name from the name of the parent and main product categories, separated by a "-" (type: string)
      "parent_id" – parent category ID (type: string)
      "url" – category page url (type: string)
    • category_ids – an array of IDs of the product category hierarchy (type: String array)
    • currency – product currency (type: string, matches the currency of the PersonaClick account, or the user value set in the settings of the PersonaClick account)
    • discount – the percentage difference between the old price and the current price (type: number)
    • discount_formatted – the percentage difference between the old and the current price that is formatted as a string with the "%" symbol (type: string)
    • discount_percent – user-defined discount value (type: number)
    • gift – specifies whether the product is a gift (type: boolean)
    • group_id – product group ID (type: string)
    • installment – the payment cost if purchasing the product in installments (type: number)
    • id – product ID (type: string)
    • image_url – URL of the original product image (type: string)
    • image_url_handle – relative URL of the original product image (type: string)
    • image_url_resized – the object with the URLs of the resize product image. Available object keys matching the size of the image in pixels: 120, 140, 160, 180, 200, 220, 310, 520 (type: object)
    • is_new – new arrival product (type: boolean). See the parameter in the product catalog import (XML, HTTP API)
    • leftovers – rough number of the products left in stock. Available values are: 
      "one" - one product
      "few" - 2-10 products
      "lot" - over 10 products
    • model –  model and product name (type: string)
    • name – product name (type: string)
    • oldprice – integer old price of the product (type: number)
    • oldprice_formatted – formatted integer old price of the product, including currency (type: string)
    • oldprice_full – old price of the product (type: number)
    • oldprice_full_formatted – formatted old price of the product, including currency (type: string)
    • params – object array with pairs of "key" (type: string), "values" (type: array) properties. The data matches the values of the "param" parameter of the product feed/catalog (XML, HTTP API).
    • picture – link to the product image in the PersonaClick image repository (type: string)
    • price – integer current price of the product (type: number)
    • price_formatted – formatted integer current price of the product, including currency (type: string)
    • price_full – current price of the product (type: number)
    • price_full_formatted – formatted current price of the product, including currency (type: string)
    • price_with_promocode – the product price when using the promo code specified for the product (type: number)
    • price_with_promocode_formatted – formatted product price when using the promo code specified for the product, including currency (type: string)
    • promocode – the promo code is for a specific product (type: string)
    • rating – product rating (type: number)
    • relative_sales_rate – level of sales of current product ( in percentage) in relation to the maximum level of sales of products in the store (type: number)
    • sales_rate – level of product sales (absolute value) (type: number)
    • url – product page URL (type: string)
    • url_handle - relative product page URL (type: string)
    products_totalnumberThe total number of products that match the search query. The following query parameters do not affect this value: page, limit, and offset.
    search_querystringThe search query text.
    brandsObject arrayObject array, each containing the name property with the vendor name in the value.
    categoriesObject array

    An array of objects with information about the categories matching the search query. Each object has the following properties:

    • id – category ID (type: string)
    • name – category name (type: string)
    • url – category page link (type: string)
    • parent – parent category ID (type: string)
    • alias – wordy category identifier (type: string)
    Note

    If no links are specified for categories in the product feed, the API will return an empty array for this property.


    filtersObject

    JSON string with properties and their values of all API response products. The data matches the values of the "param" parameter of the product feed/catalog (XML, HTTP API). Format:

    Code Block
    {"property1":["value1","value2"],"property2":["value1","value2"]}


    popupObjectReserved for the JS SDK internal use
    price_rangeObject

    The object containing the values of the minimum and maximum price of the products in the API response. Available properties:

    • min - minimum price
    • max - maximum price
    price_rangesObject arrayThe array contains objects with price ranges and the number of products that match the range. Available properties:
    • from - minimum price of the range (doesn't exist for the first range, type: number)
    • to - maximum price of the range (doesn't exist for the last range, type: number)
    • count  - number of products that match the range (type: number)
    queriesarrayReserved.

    Example of use

    Code Block
    languagejava
    themeFadeToGrey
    SearchParams params = new SearchParams();
    params.put(SearchParams.Parameter.PAGE, "2");
    params.put(SearchParams.Parameter.LIMIT, "15");
    params.put(SearchParams.Parameter.BRANDS, "Alas,poor,Yorick");
    params.put(SearchParams.Parameter.CATEGORIES, "1,146,100500");
    params.put(SearchParams.Parameter.SORT_BY, "price");
    params.put(SearchParams.Parameter.SORT_DIR, "asc");
    params.put(SearchParams.Parameter.LOCATIONS, "NY,LA");
    SearchParams.SearchFilters filters = new SearchParams.SearchFilters();
    filters.put("weight", new String[] {"11.1", "14.8"});
    params.put(SearchParams.Parameter.FILTERS, filters);
    PersonaClick.search("To be or not to be", SearchParams.TYPE.FULL, params, new Api.OnApiCallbackListener() {
        @Override
        public void onSuccess(JSONObject response) {
            // features showing full search widget
        }
    });


    Blank Request

    Method Objective

    The method allows getting the user's last search queries, last viewed or recommended products.

    Syntax and parameters

    Code Block
    languagejava
    themeFadeToGrey
    PersonaClick.search_blank(callback);

    NameTypeRequirementDescription
    callbackfunctionrequiredCallback-function, where the API response will be passed to. 

    API response

    NameTypeDescription
    productsarrayAn array of objects with product information. Each object has the following properties:
    • id – product ID (type: string)
    • group_id – product group ID (type: string)
    • name – product name (type: string)
    • url – product page link (type: string)
    • picture – link to the product image in the PersonaClick image repository (type: string)
    • price – product price (type: number)
    • old_price – product old price (type: string, default – 0)
    • currency – product currency (type: string, matches the currency of the PersonaClick account, or the user value set in the settings of the PersonaClick account)
    • price_formatted – formatted product price including currency (type: string)
    suggestsarray
    Search query suggestions.
    last_queriesarrayAn array of objects with last user's queries. Each object has the following properties:
    • name – search query (type: string)
    • url – link to a full search page (the format of the link is configured in the PersonaClick account)
    last_productsbooleanReserved for the JS SDK internal use.

    Example of use

    Code Block
    languagejava
    themeFadeToGrey
    PersonaClick.search_blank(new Api.OnApiCallbackListener() {
        @Override
        public void onSuccess(JSONObject response) {
            // features showing search widget
        }
    });



    Column

    Page Navigation

    Table of Contents
    maxLevel2
    indent0px
    stylenone




    Related Pages

    Filter by label (Content by label)
    showLabelsfalse
    showSpacefalse
    sorttitle
    cqllabel = "searchengine"