### Example Data Structure Source: https://docs.searchanise.io/update-api A complete example of the array structure containing schema definitions, items, categories, and pages. ```text Array ( [schema] => Array ( [0] => Array ( [name] => title [title] => Product name ) [1] => Array ( [name] => price [title] => Product Price [facet] => Array ( [title] => Price [type] => range [ranges] => Array ( [0] => Array ( [title] => from 0 to 150 [from] => 0 [to] => 150 ) [1] => Array ( [title] => from 150 to 800 [from] => 150 [to] => 800 ) ) ) ) [2] => Array ( [name] => categories [title] => Product Categories [type] => text [facet] => Array ( [title] => Categories [type] => select ) ) ) [items] => Array ( [0] => Array ( [id] => 1 [title] => Test product 1 [summary] => Test description [product_code] => product1 [link] => https://example.com/products/product1 [image_link] => https://example.com/images/product1.jpg [price] => 12 [categories] => Category1 [status] => active ) [1] => Array ( [id] => 2 [title] => Test product 2 [summary] => Test summary [product_code] => product2 [link] => https://example.com/products/product2 [image_link] => https://example.com/images/product2.jpg [price] => 168 [categories] => Category2 [status] => active ) ) [categories] => Array ( [0] => Array ( [id] => 1 [parent_id] => 0 [title] => Category1 title [summary] => Category1 test description [link] => https://example.com/categories/category1 [image_link] => https://example.com/images/category1.jpg ) ) [pages] => Array ( [0] => Array ( [id] => 1 [parent_id] => 0 [title] => Page1 title [summary] => Page1 test description [link] => https://example.com/pages/page1 [image_link] => https://example.com/images/page1.jpg ) ) ) ``` -------------------------------- ### Manual Installation HTML Code Snippet Source: https://docs.searchanise.io/upsell-cross-sell-setting-up-vintage This is the HTML code that needs to be inserted into the theme's .liquid file for manual installation of the Recommendation Widget. ```html
Recommendation Widget HTML code goes here
``` -------------------------------- ### Search API Endpoint Example Source: https://docs.searchanise.io/search-api An example of a search query to the Searchanise API, demonstrating the use of various parameters like q, restrictBy, and sortBy. ```APIDOC ## GET /search ### Description This endpoint allows you to search for products using various query parameters, including filtering and sorting. ### Method GET ### Endpoint https://searchserverapi1.com/search ### Query Parameters - **api_key** (string) - Required - Your Searchanise API key. - **q** (string) - Required - The search query string. - **restrictBy** (object) - Optional - Conditions for filtering results. See 'RestrictBy Parameter' section for details. - **unionBy** (object) - Optional - Conditions to replace attribute values. See 'UnionBy Parameter' section for details. - **sortBy** (string) - Optional - Specifies the sorting order for the results. See 'SortBy Parameter' section for details. ### Request Example ``` https://searchserverapi1.com/search?api_key=XXXXXXXXXX&q=keyboard&restrictBy[color]=black&restrictBy[price]=0,150.4&restrictBy[category]=Keyboards ``` ### Response #### Success Response (200) - **totalItems** (int) - The total number of found products. - **startIndex** (int) - The current value of startIndex. - **itemsPerPage** (int) - The current value of maxResults. - **currentItemCount** (int) - The number of products on the current page. - **correctedQuery** (string) - The correct value of the q parameter (in case the q parameter has been corrected). - **categoryStartIndex** (int) - The current value of categoryStartIndex. - **totalCategories** (int) - The number of found categories. - **pageStartIndex** (int) - The current value of pageStartIndex. - **totalPages** (int) - The number of found pages. - **suggestions** (array) - The array with suggestions. - **items** (array) - The array with products. - **pages** (array) - The array with pages. - **categories** (array) - The array with categories. - **facets** (array) - The array with filters. #### Response Example ```json { "totalItems": 100, "startIndex": 0, "itemsPerPage": 10, "currentItemCount": 10, "correctedQuery": "keyboard", "categoryStartIndex": 0, "totalCategories": 5, "pageStartIndex": 0, "totalPages": 10, "suggestions": [], "items": [ { "product_id": "123", "title": "Mechanical Keyboard", "link": "http://example.com/product/123", "price": 120.50, "list_price": 130.00, "quantity": 50, "product_code": "MK-001", "image_link": "http://example.com/image/123.jpg" } ], "pages": [], "categories": [], "facets": [] } ``` ``` -------------------------------- ### Perform Signup API Registration Source: https://docs.searchanise.io/signup-api Example of a successful registration request using cURL to obtain API keys. ```bash curl -X POST "http://searchserverapi1.com/api/signup/json" -d 'url=http://example.com/?language=english&email=test@example.com' > {"keys":{"api":"XXXXXXXXXX","private":"XXXXXXXXXXXXXXXXXXXX"}} ``` -------------------------------- ### Start Full Import Source: https://docs.searchanise.io/update-api Send this POST request to initiate a full data import. Changes are not indexed until the 'done' status is signaled. ```bash curl -X POST "https://searchserverapi1.com/api/state/update/json" -d 'private_key=XXXXXXXXXXXXXXXXXXXX&full_import=start' > "ok" ``` -------------------------------- ### Handle Signup API Error Source: https://docs.searchanise.io/signup-api Example of an error response returned when the registration request contains invalid parameters. ```bash curl -X POST "http://searchserverapi1.com/api/signup/json" > {"errors":{"error":"Invalid email or url"}} ``` -------------------------------- ### Get Import Status and Product Count Source: https://docs.searchanise.io/update-api Use this GET request to check the indexing status, full import status, and the number of imported products after an import. ```bash curl -X GET "https://searchserverapi1.com/api/state/get/json?private_key=XXXXXXXXXXXXXXXXXXXX&status&full_import&product_count" > {"variable":{"status":"normal","full_import":"done","product_count":"124"}} ``` -------------------------------- ### Set Minimum Price from Multiple Attributes Source: https://docs.searchanise.io/search-api This example shows how to set the price attribute to the minimum value from a list of other price attributes, separated by '|'. ```URL Parameters unionBy[price][min]=regural_price|wholesale_price ``` -------------------------------- ### Combined Filtering Example Source: https://docs.searchanise.io/search-api This example demonstrates how to combine multiple restrictBy parameters in a single API request to filter by color, price, and category. ```URL https://searchserverapi1.com/search?api_key=XXXXXXXXXX&q=keyboard&restrictBy[color]=black&restrictBy[price]=0,150.4&restrictBy[category]=Keyboards ``` -------------------------------- ### Import Product Data, Categories, and Pages Source: https://docs.searchanise.io/update-api Use this POST request to import product data, category information, and page content. The `data` parameter can accept JSON, optionally compressed with ZLIB. ```bash curl -X POST "https://searchserverapi1.com/api/items/update/json" -d 'private_key=XXXXXXXXXXXXXXXXXXXX&data=[JSON_DATA]' ``` -------------------------------- ### Reset Searchanise Setup in Magento 1 Core Resource Source: https://docs.searchanise.io/reinstall-from-scratch-magento1 Execute this SQL query to remove the Searchanise setup entry from the core_resource table, ensuring a clean state before reinstallation. This is a crucial step after deleting Searchanise database tables. ```sql DELETE FROM core_resource WHERE core_resource.`code` = ‘searchanise_setup’ ``` -------------------------------- ### Handle API error responses Source: https://docs.searchanise.io/search-api Example of a JSON response returned when an error occurs during an API request. ```json {"error":"TOO_BIG_START_INDEX"} ``` -------------------------------- ### GET /api/state/get/json (Status Check) Source: https://docs.searchanise.io/update-api Retrieves the current status of keys, indexation, and the number of imported products. ```APIDOC ## GET /api/state/get/json ### Description Checks the status of keys, full import, and gets the number of imported products. ### Method GET ### Endpoint https://searchserverapi1.com/api/state/get/json ### Parameters #### Query Parameters - **private_key** (string) - Required - Private key - **status** (string) - Optional - Status of keys and indexation - **full_import** (string) - Optional - Status of the full import - **product_count** (string) - Optional - The number of imported products ### Response #### Success Response (200) - **status** (string) - Current indexation status - **full_import** (string) - Full import status - **product_count** (string) - Number of products ### Response Example { "variable": { "status": "normal", "full_import": "done", "product_count": "124" } } ``` -------------------------------- ### Store Integration Methods Source: https://docs.searchanise.io/admin-panel-js-api Information on how to connect your store to Searchanise, including options for direct integration and using a connect link. ```APIDOC ## Store Integration ### Description Details on integrating your store with Searchanise. Supports HTTP and HTTPS addresses. ### Integration Options - **PrivateKey**: Use your private key for direct integration. - **ConnectLink**: If `ConnectLink` is specified instead of `PrivateKey`, a "Connect store to Searchanise" button will be displayed. Clicking this button redirects the user to the `ConnectLink` URL. ### Addon Status - If `AddonStatus` is set to "disabled", the message "_Addon is disabled. Please enable it_" will be displayed instead of the control panel. ### Control Panel Container - The `` container is used for the control panel. It can be placed anywhere, but should have sufficient size to display all admin content. ``` -------------------------------- ### Connect Searchanise Widgets Source: https://docs.searchanise.io/widgets-js-api Include this script block to initialize the Searchanise widgets. Ensure the ApiKey and selectors are correctly configured for your environment. ```html