Moving From IndexTank To IndexDen


Published: April 08, 2012

A while back I did a post on using IndexTank with CakePHP. Since then IndexTank has been bought by LinkedIn and will be shutdown.

Luckily there is a drop in replacement in the form of IndexDen. I was able to get Homkora switched over in about 30 minutes.

First signup for an account with IndexDen. Then create the indexes that you need. I recommend calling them whatever you called them in IndexTank, that way there is no need to change the code.

From the example in the original post

function createIndextankClient(){
    App::import('Vendor', 'indextank_client');
    $client = new ApiClient($API_URL);
    return $client;

function addIndextank($indexType,$id,$data){ //send project to indextank $client = $this->createIndextankClient(); $index = $client->get_index($indexType); $doc_id = $id; $index->add_document($doc_id, $data); }

function deleteIndextank($indexType,$id){ //delete indextank document $client = $this->createIndextankClient(); $index = $client->get_index($indexType); $index->delete_document($id); }

function searchIndextank($indexType,$query){ //search indextank $client = $this->createIndextankClient(); $index = $client->get_index($indexType); $index->add_function(2, "relevance"); $res = $index->search($query); return $res; } ?>

All you have to change is $API_URL = 'YOUR API URL HERE'; from the IndexTank URL to the IndexDen one.

That is technically all you need to do to start using IndexDen instead of IndexTank. However, you will notice that none of you records are in the new index.

A quick way to add them back in is with a simple loop. Staying with the last posts example, here is how I added the projects from Homkora.


function add_to_index() {

$projects = $this-&gt;Project-&gt;find(&#39;all&#39;);

foreach($projects as $project){
    $indexData = array(&#39;text&#39;=&gt;$project[&#39;Project&#39;][&#39;title&#39;],&#39;title&#39;=&gt;$project[&#39;Project&#39;][&#39;title&#39;],&#39;description&#39;=&gt;$project[&#39;Project&#39;][&#39;description&#39;],&#39;user_id&#39;=&gt;$project[&#39;Project&#39;][&#39;user_id&#39;]);
    $id = $project[&#39;Project&#39;][&#39;_id&#39;];



I just added in this simple function, hit the URL once, then removed it. All the old records are in, and any new records will be added thanks to the code from the first post.

So if you need a quick fix for IndexTanks closure, give IndexDen a shot. I've been in contact with the CEO of the company and he seems like a really nice guy so if you have a more complex setup, contact them and I bet they can help you out.

Edit: Other services offering drop in replacements.