make phorkie compatible with elasticsearch 1.3
authorChristian Weiske <cweiske@cweiske.de>
Wed, 5 Nov 2014 12:35:48 +0000 (13:35 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Wed, 5 Nov 2014 12:35:48 +0000 (13:35 +0100)
src/phorkie/Database/Adapter/Elasticsearch/Indexer.php

index e93cfa7..6da974a 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();
     }