first frontend
[phinde.git] / src / phinde / Elasticsearch.php
similarity index 92%
rename from src/Elasticsearch.php
rename to src/phinde/Elasticsearch.php
index b3f306747e611022c814cf55aaabbd79c2650dc5..4bc4637440e9a103f39a5e086bde7789612e1b07 100644 (file)
@@ -68,7 +68,7 @@ class Elasticsearch
         $r->send();
     }
 
-    public function search($query, $page, $perPage)
+    public function search($query, $filters, $page, $perPage)
     {
         $r = new Elasticsearch_Request(
             $this->baseUrl . 'document/_search',
@@ -94,7 +94,7 @@ class Elasticsearch
                             'term' => array(
                                 'status' => 'indexed'
                             )
-                        )
+                        ),
                     )
                 )
             ),
@@ -126,6 +126,14 @@ class Elasticsearch
                 //array('modate' => array('order' => 'desc'))
             )
         );
+        foreach ($filters as $type => $value) {
+            $doc['query']['bool']['must'][] = array(
+                'term' => array(
+                    $type => $value
+                )
+            );
+        }
+
         //unset($doc['_source']);
 
         //ini_set('xdebug.var_display_max_depth', 10);