@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | |
4 | 4 | |
5 | -function app_content( $request, $args ){ |
|
5 | +function app_content($request, $args) { |
|
6 | 6 | |
7 | 7 | global $ES; |
8 | 8 | $index = $args['index']; |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | $params['type'] = $type; |
18 | 18 | $params['sort'] = $sort; |
19 | 19 | $params['from'] = $from; |
20 | - $params['size'] = $size; |
|
20 | + $params['size'] = $size; |
|
21 | 21 | if (!empty($query)) { |
22 | 22 | $body = json_decode($query); |
23 | 23 | if (json_last_error() == JSON_ERROR_NONE) { |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | } |
28 | 28 | } |
29 | 29 | $results = $ES->search($params); |
30 | - foreach ($results['hits']['hits'] as $doc){ |
|
30 | + foreach ($results['hits']['hits'] as $doc) { |
|
31 | 31 | $doc['_source']['_id'] = $doc['_id']; |
32 | - $documents[]=$doc['_source']; |
|
32 | + $documents[] = $doc['_source']; |
|
33 | 33 | } |
34 | 34 | $params['search_type'] = 'count'; |
35 | 35 | $count = $ES->search($params); |
36 | 36 | $nof = 0; |
37 | - if( isset( $count['hits']['total'] ) ){ |
|
38 | - $nof = (int) $count['hits']['total']; |
|
37 | + if (isset($count['hits']['total'])) { |
|
38 | + $nof = (int) $count['hits']['total']; |
|
39 | 39 | } |
40 | - return ['app_title'=>$index."/".$type ,'data'=>[ 'index' => $index, 'type' => $type, 'documents'=> $documents, 'from' => $from, 'nof'=>$nof, 'size' => $size,'sort'=>$sort, 'query'=>$query]]; |
|
40 | + return ['app_title'=>$index . "/" . $type, 'data'=>['index' => $index, 'type' => $type, 'documents'=> $documents, 'from' => $from, 'nof'=>$nof, 'size' => $size, 'sort'=>$sort, 'query'=>$query]]; |
|
41 | 41 | } |