Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = 'localhost';
- $db = 'webcrawler';
- $user = 'webcrawler';
- $pass = 'secret';
- $charset = 'utf8';
- $dsn = "mysql:host=$host;dbname=$db;charset=$charset";
- $pdo = new PDO($dsn, $user, $pass);
- $sql = 'SELECT * FROM document
- WHERE MATCH (`text`, subject, title, description, creator, publisher)
- AGAINST (:search IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);';
- $stmt = $pdo.prepare($sql);
- $stmt.execute(['search' => 'my-search-phrase']);
- while($doc = $stmt->fetch(PDO::FETCH_OBJ)) {
- echo "URL: $doc->url Content-Type: $doc->content_type Crawled Date: $doc->crawl_date";
- }
Add Comment
Please, Sign In to add comment