use httprequest wrapper to automatically check for errors
[phorkie.git] / src / phorkie / Search / Elasticsearch.php
index 3c3ea8351f2397f373f6bd5951a9272b19f1b2d7..06a0cfe57552cac5e72ab5e9848f732ff08faf8b 100644 (file)
@@ -20,7 +20,7 @@ class Search_Elasticsearch
      */
     public function search($term, $page = 0, $perPage = 10)
     {
-        $r = new \HTTP_Request2(
+        $r = new Database_Adapter_Elasticsearch_HTTPRequest(
             $this->searchInstance . 'repo/_search',
             \HTTP_Request2::METHOD_GET
         );
@@ -34,7 +34,8 @@ class Search_Elasticsearch
                             'should' => array(
                                 (object)array(
                                     'query_string' => (object)array(
-                                        'query' => $term
+                                        'query' => $term,
+                                        'default_operator' => 'AND'
                                     ),
                                 ),
                                 (object)array(
@@ -42,7 +43,8 @@ class Search_Elasticsearch
                                         'type'         => 'file',
                                         'query' => (object)array(
                                             'query_string' => (object)array(
-                                                'query' => $term
+                                                'query' => $term,
+                                                'default_operator' => 'AND'
                                             )
                                         )
                                     )