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 | ||||
---|---|---|---|---|
| ||||
PersonaClick.search(search_query, type, params, callback); |
Name | Type | Requirement | Description |
---|---|---|---|
search_query | string | required | The search query text. |
type | enum | required | Search Type. See the example below. |
params | enum | required | Request parameters. See the description below. |
successcallback | function | required | Callback-function, where the API response will be passed to. |
Request parameters
Name | Type | Requirement | Description |
---|---|---|---|
LOCATIONS | string | optionally | String with location IDs separated by comma. If used, the API response will return products available in the listed locations. |
API response
Name | Type | Description |
---|---|---|
products | array | An array of objects with product information. Each object has the following properties:
|
|
|
|
|
|
|
|
|
|
| ||
products_total | number | The total number of products that match the search query. |
search_query | string | The search query text. |
categories | array | An array of objects with information about the categories matching the search query. Each object has the following properties:
|
If no links are specified for categories in the product feed, the API will return an empty array for this property. | ||
queries | array | An array of objects with relevant popular queries. Each object has the following properties:
|
html |
string | Contains 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_redirects | object | The object will be available if a redirect is created for the search query: Account -> Search -> Search redirect The object contains the following properties:
|
Example of use
Code Block | ||||
---|---|---|---|---|
| ||||
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.
.
You can find the DIV in the Search Section of the PersonaClick account.Syntax and parameters
Code Block | ||||
---|---|---|---|---|
| ||||
personaclickPersonaClick.search("search"_query, paramstype, successparams, errorcallback); |
Name | Type | Requirement | Description |
---|---|---|---|
search_query | string | required | The search query text. |
type | enum | required | Search Type. See the example below. |
params |
enum | required |
Request parameters. See the description below. |
callback | function | required | Callback-function, where the API response will be passed to. |
Request Parameters
Name | Type | Requirement | Description | ||||
---|---|---|---|---|---|---|---|
search_queryLIMIT | string | required | The search query text. | limit | number | optionally | The maximum number of products in the API response (by default - 10). |
pagePAGE | numberstring | optionally | Page number (first page - 1, by default - 1). | ||||
offsetBRANDS | numberstring | optionally | The offset relative to the first product in the API response (similar to: (page - 1) * limit and when used simultaneously with page is a priority, by default - 0). | brands | array | optionally | An array of vendor names. If String 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. |
COLORS | string | optionally | String with color names separated by comma. If used, the API response will return only the products of the listed vendorscolors. The vendors must be listed colors of the product should be specified in the product feed.colors | ||||
FASHION_SIZES | arraystring | optionally | An array of product colors. If String with fashion sizes values separated by comma. If used, the API response will return the products of the listed colorssizes. The colors sizes of the product should be specified in the product feed. | ||||
pricePRICE_minMIN | numberstring | optionally | Minimum product price in API response. | ||||
pricePRICE_maxMAX | numberstring | optionally | Maximum product price in API response. | ||||
categoriesLOCATIONS | arraystring | optionally | An array of category IDsString with location IDs separated by comma. If used, the API response will return only those products that are available in the specified categorieslisted locations. | ||||
category_namesCATEGORIES | numberstring | optionally | Using the category names in the search. If String with category IDs separated by comma. If used, the API response will respond with products from categories whose names intersect with the search query. These products will get the lowest priority and will be at the very end of the response. By default - 1.sort_byreturn only those products that are in the specified categories. | ||||
SORT_BY | string | optionally | Sorting products in the API response. Available values:
| ||||
orderSORT_DIR | string | optionally | Sorting directions for the
| ||||
FILTERS | string | optionally | Additional request filters. See the example below. |
API response
Name | Type | Description |
---|---|---|
html | string | HTML code of the widget with full search results. Widget template is customizable in PersonaClick account. |
products | array | An array of objects with product information. Each object has the following properties:
|
|
|
|
|
|
|
|
|
| ||
products_total | number | The total number of products that match the search query. The following query parameters do not affect this value: page, limit, and offset. |
search_query | string | The search query text. |
brands | Object array |
Object array, each containing the name property with the vendor name in the value. | |
categories | Object array |
An array of objects with information about the categories matching the search query. Each object has the following properties:
| ||
filters | Object | |
popup | Object | Reserved for the JS SDK internal use |
price_range | Object | The object containing the values of the minimum and maximum price of the products in the API response. Available properties:
|
price_ranges | Object array | The array contains objects with price ranges and the number of products that match the range. Available properties:
|
queries | array | Reserved. |
Example of use
Code Block | ||||
---|---|---|---|---|
| ||||
personaclick("search", {search_query: "To be or not to be", page: 2, limit: 15, brands: ["Alas", "poor", "Yorick"], categories: [1, 146, 100500], sort_by: "price", order: "asc"}, function(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,
function(errorlast viewed or recommended products.
Syntax and parameters
Code Block | ||||
---|---|---|---|---|
| ||||
PersonaClick.search_blank(callback); |
Name | Type | Requirement | Description |
---|---|---|---|
callback | function | required | Callback-function, where the API response will be passed to. |
API response
Name | Type | Description |
---|---|---|
products | array | An array of objects with product information. Each object has the following properties:
|
suggests | array | Search query suggestions. |
last_queries | array | An array of objects with last user's queries. Each object has the following properties:
|
last_products | boolean | Reserved for the JS SDK internal use. |
Example of use
Code Block | ||||
---|---|---|---|---|
| ||||
PersonaClick.search_blank(new Api.OnApiCallbackListener() { @Override public void onSuccess(JSONObject response) { // when something went wrong features showing search widget } }); |
Column | ||||
---|---|---|---|---|
Page Navigation
|
Related Pages
|