use configured elasticsearch address
authorChristian Weiske <cweiske@cweiske.de>
Tue, 1 May 2012 19:31:46 +0000 (21:31 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Tue, 1 May 2012 19:31:46 +0000 (21:31 +0200)
scripts/index.php
scripts/search.php

index 9a93488240139af9bf28fbce8caecb10b4b4c93b..893e3fb7c3aee3d322e41e57fb2c8967268212ba 100644 (file)
@@ -26,7 +26,7 @@ if ($GLOBALS['phorkie']['cfg']['setupcheck']) {
 
 //delete all repos
 $r = new \HTTP_Request2(
 
 //delete all repos
 $r = new \HTTP_Request2(
-    'http://localhost:9200/phorkie/repo/_query',
+    $GLOBALS['phorkie']['cfg']['elasticsearch'] . 'repo/_query',
     \HTTP_Request2::METHOD_DELETE
 );
 $r->setBody(
     \HTTP_Request2::METHOD_DELETE
 );
 $r->setBody(
@@ -38,7 +38,7 @@ $r->setBody(
 );
 $r->send();
 $r = new \HTTP_Request2(
 );
 $r->send();
 $r = new \HTTP_Request2(
-    'http://localhost:9200/phorkie/file/_query',
+    $GLOBALS['phorkie']['cfg']['elasticsearch'] . 'file/_query',
     \HTTP_Request2::METHOD_DELETE
 );
 $r->setBody(
     \HTTP_Request2::METHOD_DELETE
 );
 $r->setBody(
@@ -52,7 +52,7 @@ $r->send();
 
 //create mapping
 $r = new \HTTP_Request2(
 
 //create mapping
 $r = new \HTTP_Request2(
-    'http://localhost:9200/phorkie/file/_mapping',
+    $GLOBALS['phorkie']['cfg']['elasticsearch'] . 'file/_mapping',
     \HTTP_Request2::METHOD_PUT
 );
 $r->setBody(
     \HTTP_Request2::METHOD_PUT
 );
 $r->setBody(
@@ -74,8 +74,7 @@ $r->send();
 $rs = new Repositories();
 foreach ($rs->getList(0, 10000) as $repo) {
     $r = new \HTTP_Request2(
 $rs = new Repositories();
 foreach ($rs->getList(0, 10000) as $repo) {
     $r = new \HTTP_Request2(
-        //FIXME: make configurable
-        'http://localhost:9200/phorkie/repo/' . $repo->id,
+        $GLOBALS['phorkie']['cfg']['elasticsearch'] . 'repo/' . $repo->id,
         \HTTP_Request2::METHOD_PUT
     );
     $r->setBody(
         \HTTP_Request2::METHOD_PUT
     );
     $r->setBody(
@@ -90,8 +89,7 @@ foreach ($rs->getList(0, 10000) as $repo) {
 
     foreach ($repo->getFiles() as $file) {
         $r = new \HTTP_Request2(
 
     foreach ($repo->getFiles() as $file) {
         $r = new \HTTP_Request2(
-            //FIXME: make configurable
-            'http://localhost:9200/phorkie/file/?parent=' . $repo->id,
+            $GLOBALS['phorkie']['cfg']['elasticsearch'] . 'file/?parent=' . $repo->id,
             \HTTP_Request2::METHOD_POST
         );
         $r->setBody(
             \HTTP_Request2::METHOD_POST
         );
         $r->setBody(
index af7a08573d779f94f4cd1d08413150e2145970c0..f9688bb35320bef97a5d0dd646275434a39beefc 100644 (file)
@@ -25,7 +25,7 @@ if ($GLOBALS['phorkie']['cfg']['setupcheck']) {
 }
 
 $r = new \HTTP_Request2(
 }
 
 $r = new \HTTP_Request2(
-    'http://localhost:9200/phorkie/repo/_search',
+    $GLOBALS['phorkie']['cfg']['elasticsearch'] . 'repo/_search',
     \HTTP_Request2::METHOD_GET
 );
 $r->setBody(
     \HTTP_Request2::METHOD_GET
 );
 $r->setBody(