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
PersonaClicksdk.search(search_query, type, params, callback);suggest(params) { callback }

The search query text.
NameTypeRequirementDescriptionsearch_querystringrequired
typeenumrequiredSearch Type. See the example below.
paramsenum
requiredRequest parameters. See the description below.
callbackfunctionrequiredCallback-function, where the API response will be passed to. 

Request parameters

NameTypeRequirementDescription
LOCATIONSquerystringoptionallyString with location IDs separated by comma. If used, the API response will return products available in the listed locations.requiredThe search query text.

API response

Name
Type
Description
productsarrayAn array of objects with product information. Each object has the following properties:
  • id – product 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
  • oldprice – 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)
  • brand – product vendor (type: string)
  • is_new – new arrival product (type: boolean). See the parameter in the product catalog import (XML, HTTP API)
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)
note
  • 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)
book_authors
html
arrayReserved.collectionsarrayReserved.keywordsarrayReserved.virtual_categoriesarrayReserved.
stringContains 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("sdk.suggest(query: "To be or not to be", SearchParams.TYPE.INSTANT, params, new Api.OnApiCallbackListener() {     @Override
    public void onSuccess(JSONObject response) {
   searchResult in
    // 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
PersonaClicksdk.search(search_query, type, params, callback);params) { callback }

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

Request Parameters

NameTypeRequirementDescription
LIMIT
querystringrequiredThe search query text.
limitnumberoptionallyThe maximum number of products in the API response (by default - 10).
PAGE
offset
string
numberoptionally
Page number (first page - 1, by default - 1).BRANDSstringoptionallyString with vendor names separated by comma
The offset relative to the first product in the API response
brandsDictionary ListoptionallyDictionary List of brands. If used, the API response will return only the products of the listed vendors. The vendors must be listed in the product feed.
COLORS
colors
string
Dictionary Listoptionally
String with color names separated by comma
Dictionary List of colors. 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.
fashionSizesDictionary List
Dictionary List of fashion sizes. 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_MIN
priceMin
string
numberoptionallyMinimum product price in API response.
PRICE_MAX
priceMax
string
numberoptionallyMaximum product price in API response.
LOCATIONS
locations
string
Dictionary Listoptionally
String with location IDs separated by comma
Dictionary List of Location IDs. If used, the API response will return products available in the listed locations.
CATEGORIES
categories
string
Dictionary Listoptionally
String with category IDs separated by comma
Dictionary List of Category IDs. If used, the API response will return only those products that are in the specified categories.
SORT_BY
sortBystringoptionallySorting 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_DIR
sortDirstringoptionally

Sorting directions for the sort_by parameter.
Available values:

  • asc - ascending sorting
  • desc - downwards sorting (by default)
FILTERS
filtersstringoptionally
Additional
JSON object with additional request filters. See the example below.
brandLimitnumberoptionallyHow many brands for sidebar filter to return.
categoryLimitnumberoptionallyHow many categories for sidebar filter to return.
excludeDictionary ListoptionallyDictionary List of IDs of products to be excluded.

API response

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

An array of objects with

product

information about the categories matching the search query. Each object has the following properties:

  • id –
product
  • category ID (type: string)
  • name –
product
  • category name (type: string)
  • url –
product
  • category page link (type: string)
picture – link to the product image in the PersonaClick image repository old_price – product old price (type: string, by default – 0
  • parent – parent category ID (type: string)
  • price – product price (type: number)
    • 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.

    productsObject Array

    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)
    • 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
    • id – product ID (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
    • )
    • isNew – new arrival product (type: boolean). See the parameter in the product catalog import (XML, HTTP API)
    • model –  model and product name (type: string)
    • name – product name (type: string)
    • oldPrice – old price of the product with zeroed pennies (type: double)
    • oldPriceFormatted – formatted integer old price of the product, including currency (type: string)
    • oldPriceFull – old price of the product (type: double)
    • oldPriceFullFormatted – formatted old price of the product, including currency (type: string)
    • params – JSON of 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 – current price of the product with zeroed pennies (type: double)
    • priceFormatted – formatted integer current price of the product, including currency (type: string)
    • priceFull – current price of the product (type: double)
    • priceFullFormatted – formatted current price of the product, including currency (type: string)
    • url – product page URL (type: string)
    productsTotalnumberThe total number of products that match the search query.
    queriesarrayAn array of queries related to the search query.

    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) {
            sdk.search(query: "To be or not to be", limit: 15, offset: 3, categoryLimit: 5, categories: ["1", "146", "100500"], extended: false, sortBy: "price", sortDir: "asc", locations: ["NY", "LA"], brands: ["Alas", "poor", "Yorick"], filters: ["bluetooth":["yes"],"offers":["15% cashback"],"weight":["1.6"]], priceMin: 1000, priceMax: 5000, colors: ["red", "yellow", "green"], exclude: ["100", "146", "231"]) { searchResult in
        // features showing full search widget
        }
    });



    Blank Request

    Method Objective

    The method allows getting the user's last recent search queries, last viewed or recommended productsas well as recommended suggestions and products for the user.

    Syntax and parameters

    Code Block
    languagejava
    themeFadeToGrey
    PersonaClicksdk.search_blank(callback);searchBlank() { callback }


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

    API response

    NameTypeDescription
    lastQueriesQuery array

    The user's most recent search queries. Each Query in the array contains the following properties:

    • name – the search query
    • url – the URL to the full search page with the matching search query
    productsProduct array

    An array

    of objects

    with product information. Each

    object

    Product has the following properties:

    • barcode – product barcode, if it was imported in the product catalog (type: string)
    id
    • brand – product
    ID
    • vendor (type: string)
    • currency – product currency (type: string, matches the currency of the PersonaClick account, or the user value set in the settings of the PersonaClick account)
    name
    • deeplinkIos – product
    name
    • deep link for iOS (type: string)
    • discount – the percentage difference between the old price and the current price (type: number)
    url
    • id – product
    page link
    • ID (type: string)
    • imageUrl – URL of the original product image (type: string)
    picture
    • resizedImageUrl – link to the product image in the PersonaClick image repository (type: string)
    • resizedImages – 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)
    • isNew – new arrival product (type: boolean). See the parameter in the product catalog import (XML, HTTP API)
    price – product price
    • model –  model and product name (type: string)
    • name – product name (type: string)
    • oldPrice – integer old price of the product (type: number)
    • oldPriceFormatted – formatted integer old
    _price – product old price
    • price of the product, including currency (type: string)
    • oldPriceFull – old price of the product (type: number)
    • oldPriceFullFormatted – formatted old price of the product, including currency (type: string
    , default – 0
    • )
    currency – product currency
    • params – object array with pairs of "key" (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
    • "values" (type: array) properties. The data matches the values of the "param" parameter of the product feed/catalog (XML, HTTP API).
    • price – integer current price of the product (type: number)
    • priceFormatted – formatted integer current price of the product, including currency (type: string)
    • priceFull – current price of the product (type: number)
    • priceFullFormatted – formatted current price of the product, including currency (type: string)
    • relativeSalesRate – level of sales of current product ( in percentage) in relation to the maximum level of sales of products in the store (type: number)
    • salesRate – level of product sales (absolute value) (type: number)
    • url – product page URL (type: string)
    suggests
    lastProducts
    array
    Search query suggestions.
    last_queriesarrayAn array of objects with last user's queries. Each object has
    booleanIf true, then the products property of the API response contains the products recently viewed by the user, otherwise, it contains the recommended products.
    suggestsSuggest arrayUser-relevant suggestions. Each Suggest in the array contains the following properties:
    • name – the search query
    (type: string)
    • url
     – link
    •  – the URL to
    a
    • the full search page
    (the format of the link is configured in the PersonaClick account)last_productsbooleanReserved for the JS SDK internal use.
    • with the matching search query

    Example of use

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



    Column

    Page Navigation

    Table of Contents
    maxLevel2

    classpersonaclick-fixed-position

    indent0px
    stylenone




    Related Pages

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