Full Text Search - חיפוש מחיר לפי טקסט חופשי

Search for products using Full Text Search on Priceli DB. The search has two modes:

  • Search using text related with product and text related with stores info (both parameters or alone)
  • Search using single text that will be applied to both: product nfor and stores info

This search provide location based parameters that can be used to nerrow the search for a given location. See relevant parameters below.

 

Request parameters: 

Standard search parameters

  • product_text - used apply search token to products info. May be combined with 'store_text ' parameter' or alone to search only by product infomration. 
  • store_text - used to apply search tokens to stores info.  May be combined with 'product_text' parameter' or alone to search only by stores information. 
  • text  - can be used in order to provide single text parameter that is applied for both product and stores information.  

Store parameters

  • include_store_data: set true to add basic store data into products items. Setting this paremeter to true is also a precondition for using location based search,
  • latitude: for searching by location set this parameter with latitude coordinate. 
  • longitude: for searching by location set this parameter with longitude coordinate.   
  • distance: when searching by location you can use this optional parameter to specify the distance from store's location. Value represents distences from store position in "meters" for which you would like to get positive response.

Note that for location based search both 'latitude' and 'longitude' must be provided. The 'distance' os optiona and if not provided distance is set to default of 30 meters.  

Sample code: 

<?php

$params = array(
    "api_key" => "YOUR_API_KEY", // or "access_token" => "some-token"
    "text" => "אפונה",
);
$url = "http://api.priceli.co.il/v1/priceli/products-fts";
$response = curlGET($url, $params);
$data = json_decode($response);
echoResponse($response);

if ($data->status == 1) {
    //do something with product data

} else {
    echo "Error occur: " . $data->message;
}

function echoResponse($response){
    echo '<html><head><meta charset="UTF-8"></head><body>';
    echo $response;
    echo '</body></html>';
}

function curlGET($url, $data, &$errorBuf = null) {
    if ($data == null) {
        $data = array();
    }
    $url = $url . "?" . http_build_query($data);

    $curl = curl_init();
    curl_setopt_array($curl, array(
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_URL => $url,
    ));
    $response = curl_exec($curl);
    if (!$response) {
        $response = false;
        if ($errorBuf != null) {
            $errorBuf = curl_error($curl);
        }
    }
    curl_close($curl);
    return $response;
}
?>
Sample Response : 
{
  "status": 1,
  "count": 100,
  "total": 100,
  "pageLimit": -1,
  "pageNum": 1,
  "data": [
    {
      "chain_id": "7290492000005",
      "store_id": "501",
      "item_code": "7290000104201",
      "item_name": "××¤×•× ×” ×¢×“×™× ×” 600 גר .",
      "item_price": "17.90",
      "manufacturer_name": null,
      "manufacturer_country": null,
      "manufacturer_item_description": null,
      "serp": "6.519528865814209"
    },
    {
      "chain_id": "7290492000005",
      "store_id": "535",
      "item_code": "7290000208077",
      "item_name": "××¤×•× ×” גדולה יכין",
      "item_price": "8.20",
      "manufacturer_name": null,
      "manufacturer_country": null,
      "manufacturer_item_description": null,
      "serp": "6.519528865814209"
    },

    //........ other items ordered by'serp' ....... 
    
    {
      "chain_id": "7290492000005",
      "store_id": "535",
      "item_code": "7290002360230",
      "item_name": "חרדל דיזון גרגירים",
      "item_price": "13.60",
      "manufacturer_name": null,
      "manufacturer_country": null,
      "manufacturer_item_description": null,
      "serp": "0"
    }
  ],
  "Time_taken": null
}