make phorkie compatible with elasticsearch 1.3
[phorkie.git] / src / phorkie / Database / Adapter / Elasticsearch / Indexer.php
index e93cfa7c4b93d13b209d6b09fbbbef462cf99cb3..6da974ab0c6d038cd35cda527c9b9cfd98dba14b 100644 (file)
@@ -117,30 +117,15 @@ class Database_Adapter_Elasticsearch_Indexer implements Database_IIndexer
     public function deleteAllRepos()
     {
         $r = new Database_Adapter_Elasticsearch_HTTPRequest(
-            $this->searchInstance . 'repo/_query',
+            $this->searchInstance . 'repo',
             \HTTP_Request2::METHOD_DELETE
         );
-        $r->allow404 = true;
-        $r->setBody(
-            json_encode(
-                (object)array(
-                    'match_all' => (object)array()
-                )
-            )
-        );
         $r->send();
+
         $r = new Database_Adapter_Elasticsearch_HTTPRequest(
-            $this->searchInstance . 'file/_query',
+            $this->searchInstance . 'file',
             \HTTP_Request2::METHOD_DELETE
         );
-        $r->allow404 = true;
-        $r->setBody(
-            json_encode(
-                (object)array(
-            'match_all' => (object)array()
-                )
-            )
-        );
         $r->send();
     }
 
@@ -161,19 +146,10 @@ class Database_Adapter_Elasticsearch_Indexer implements Database_IIndexer
     {
         //delete files of that repository
         $r = new Database_Adapter_Elasticsearch_HTTPRequest(
-            $this->searchInstance . 'file/_query',
+            $this->searchInstance . 'file/_query'
+            . '?q=_parent:' . $repo->id,
             \HTTP_Request2::METHOD_DELETE
         );
-        $r->allow404 = true;
-        $r->setBody(
-            json_encode(
-                (object)array(
-                    'field' => (object)array(
-                        '_parent' => $repo->id
-                    )
-                )
-            )
-        );
         $r->send();
     }