'should' => array(
(object)array(
'query_string' => (object)array(
- 'query' => $term
+ 'query' => $term,
+ 'default_operator' => 'AND'
),
),
(object)array(
'type' => 'file',
'query' => (object)array(
'query_string' => (object)array(
- 'query' => $term
+ 'query' => $term,
+ 'default_operator' => 'AND'
)
)
)
)
)
);
- //FIXME: error handling
$httpRes = $r->send();
$jRes = json_decode($httpRes->getBody());
+ if (isset($jRes->error)) {
+ throw new Exception(
+ 'Search exception: ' . $jRes->error, $jRes->status
+ );
+ }
$sres = new Search_Result();
$sres->results = $jRes->hits->total;