Compare commits

...

1 Commits

Author SHA1 Message Date
Michael RICOIS
f45e2b9897 Update lib doofinder to the lastest 2017-08-08 15:36:05 +02:00

View File

@ -30,7 +30,7 @@ class DoofinderApi{
const DEFAULT_TIMEOUT = 10000;
const DEFAULT_RPP = 10;
const DEFAULT_PARAMS_PREFIX = 'dfParam_';
const DEFAULT_API_VERSION = '4';
const DEFAULT_API_VERSION = '5';
const VERSION = '5.2.3';
private $api_key = null; // user API_KEY
@ -169,10 +169,12 @@ class DoofinderApi{
curl_setopt($session, CURLOPT_HEADER, false); // Tell curl not to return headers
curl_setopt($session, CURLOPT_RETURNTRANSFER, true); // Tell curl to return the response
curl_setopt($session, CURLOPT_HTTPHEADER, $this->reqHeaders()); // Adding request headers
curl_setopt($session, CURLOPT_SSL_VERIFYPEER, false); // Adding request headers
curl_setopt($session, CURLOPT_SSL_VERIFYHOST, false); // Adding request headers
//IF YOU MAKE REQUEST FROM LOCALHOST OR HAVE SERVER CERTIFICATE ISSUE, UNCOMMENT THE 2 LINES BELOW
curl_setopt($session, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($session, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($session);
$httpCode = curl_getinfo($session, CURLINFO_HTTP_CODE);
//print curl_errno($session);
curl_close($session);
if (floor($httpCode / 100) == 2) {
@ -225,6 +227,7 @@ class DoofinderApi{
if(!$this->optionExists('query') || !trim($this->search_options['query'])){
$params['query_name'] = 'match_all';
}
// if filters without query_name, pre-query first to obtain it.
if (empty($params['query_name']) && !empty($params['filter']))
{
@ -312,7 +315,11 @@ class DoofinderApi{
* @return array assoc array filterName => filterConditions
*/
public function getFilters(){
return $this->search_options['filter'];
if(isset($this->search_options['filter'])){
return $this->search_options['filter'];
}else{
return false;
}
}
@ -637,6 +644,10 @@ class DoofinderResults{
// mark "selected" true or false according to filters presence
foreach($this->facets as $facetName => $facetProperties){
if(!isset($facetProperties['_type'])){
$facetProperties['_type'] = null;
//$facetProperties['_type'] = (array_key_exists('terms',$facetProperties)?'terms':((array_key_exists('range',$facetProperties))?'range':null));
}
switch($facetProperties['_type']){
case 'terms':
foreach($facetProperties['terms'] as $pos => $term){