Ejemplo n.º 1
0
    }
    if (isset($_POST['range'])) {
        $range = $_POST['range'];
        $arr = explode('-', $_POST['range']);
        $lower_bound = $arr[0];
        $upper_bound = $arr[1];
        if ($lower_bound == 20000) {
            $upper_bound += 100000;
        }
        $range_array = ["range" => ["least_price" => ["lte" => $upper_bound, "gt" => $lower_bound]]];
        $filter[] = $range_array;
    }
    if (empty($filter)) {
        $filter = 0;
    }
}
if (isset($_POST['brand'])) {
    $brandFields = $_POST['brand'];
}
if (isset($_POST['range'])) {
    $arr = explode('-', $_POST['range']);
    $rangeField = $arr[0];
}
$from = $cur_page * 10;
$results = $esObject->Query($query, $filter, $from);
$total = $results['hits']['total'];
if ($total == 0) {
    header("Location: pagenotfound.html");
}
$allBrands = ElasticSearch::getAllBrands($results);
$range_to_filter = ElasticSearch::getAllRanges($results);