public function testSearch5() { $fields = ['title', 'tags', 'description', 'address', 'city']; $search = new GlServerSearch(__DIR__ . "/data/web.db", "web", $fields); $json = $search->queryJson("l'ame soeur"); $obj = json_decode($json); $this->assertEquals(1, count($obj->results)); }
<?php include __DIR__ . "/../../src/GlServerSearch.php"; use GlSearchEngine\GlServerSearch; $query = null; $filter = null; if (isset($_GET['q'])) { $query = $_GET['q']; } if (!$query) { return; } if (isset($_GET['f'])) { $filter = $_GET['f']; } $dbname = __DIR__ . "/../server/data/web.db"; $fields = ['title', 'tags', 'description', 'address', 'city']; $search = new GlServerSearch($dbname, "web", $fields); $json = $search->queryJson($query, $filter); header('Access-Control-Allow-Origin: *'); header('Content-Type: application/json;charset=utf-8;'); echo $json;