Advertisement
Guest User

Untitled

a guest
Jan 30th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <?php
  2. $username = 'mongodbusername';
  3. $password = 'changeMe';
  4. $m = new MongoClient("mongodb://myadmin1:myadmin123@localhost/dbname");
  5. //$m = new MongoClient("mongodb://localhost", array("username" => $username, "password" => $password,"db" => "jobma_integrations"));
  6. $db = $m->integrations; // this is your dbname
  7. $crawlingCollection = $db->crawled_jobs; // this is your collection name
  8. $c = $crawlingCollection->find(
  9. ['$text' => ['$search' => "sales "ardmore""]], // this "ardmore" is used for exact match and sales will be match with any where
  10. ['score'=> ['$meta'=>'textScore']]
  11. )->sort(
  12. ['score'=> ['$meta'=>'textScore']]
  13. );
  14. echo "<pre>";
  15. var_dump(iterator_to_array($c));
  16. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement