Remove Index

5 views
Skip to first unread message

BlackMage

unread,
Jan 29, 2012, 9:05:27 PM1/29/12
to MongoLantern
Is there a way of removing an index from mongolantern? Didn't see a
remove function in the MongoLanternIndexer file.

Sougata Pal.

unread,
Jan 29, 2012, 11:40:28 PM1/29/12
to mongol...@googlegroups.com

No. There's no way yet.  I will create an issue for it.

Thanks
Sougata Pal

- Sent via Google Android

ProdigyView

unread,
Jan 31, 2012, 1:05:49 PM1/31/12
to mongol...@googlegroups.com
I added this method to the indexer file on my version for removing a document.

/**
* Removes the document from the collection based upon on the assigned
* id of the document.
* @param string $document_id The id of the documentID to be removed from the collection
* @param array $options An array of options that can be used to customize the removel process
* @return mixed $removed Returns either a boolean or an array based upon past options
* @access public
* @todo Figure out how to remove tokenChunks, if neccesary
*/
public function removeDocument($document_id, array $options = array()) {


$collection = $this->collection;

 

$conditions = array('documentID' => $document_id);

 

return  $this->MongoDBH->$collection-> remove ($conditions, $options); 
}

It works the same way the indexer is normally called

$indexer = new MongoLanternIndexer();
$indexer->indexName = 'Images';


$indexer->Connect(PVDatabase::getDatabaseLink());


return $indexer-> removeDocument( $this -> lantern_id );

Sougata Pal.

unread,
Feb 1, 2012, 2:50:30 AM2/1/12
to mongol...@googlegroups.com
Great. Thanks.

I will add it to next release.
--
Thanks
Sougata Pal.
Chief Architect, Techunits
http://in.linkedin.com/in/skallpaul
Contact: +91 9051042886
Reply all
Reply to author
Forward
0 new messages