How to search in fulltext index using php in mongodb -
i'm using mongodb 2.4 , added fulltext index "title" field in 1 collection. how should search in field using php?
this code use right now:
$params = array( '_id' => array( '$gt' => (int)$gt ) ); $r = $this->collection->find( $params )->limit($limit);
this seem answer question:
<?php $result = $db->command( array( 'text' => 'bar', //this name of collection searching 'search' => 'hotel', //the string search 'limit' => 5, //the number of results, default 1000 'project' => array( //the fields retrieve db 'title' => 1 ) ) );
Comments
Post a Comment