glicer/search

自动完成、搜索和实时输入浏览

dev-master 2015-10-24 11:21 UTC

This package is not auto-updated.

Last update: 2024-09-14 17:48:18 UTC


README

使用javascript(客户端)和php(服务器端)的实时全文搜索解决方案

实时自动完成、搜索和实时输入浏览

Sample Search

它支持

查看 演示

欢迎反馈

服务器端

导入数据

数据必须是yaml格式,一些示例在 tests/server/data

    <?php
    use Symfony\Component\Console\Output\ConsoleOutput;
    use GlSearchEngine\GlServerEngine;

    $output    = new ConsoleOutput();

    $yamlFiles      = [__DIR__ . "/data/web.yml", __DIR__ . "/data/web2.yml"];  //yaml files list to import in database
    $dbname         = __DIR__ . "/data/web.db"; //database path
    $table          = "web";    //prefix table name
    $fieldsFullText = ['title', 'tags', 'description', 'address', 'city'];  //fields list to fulltext search
    $fieldsFilter   = ['gps']; //fields list possibly used to filter

    $engine = new GlServerEngine($dbname, $output, true);
    $engine->importYaml(
           $table,
           $fieldsFilter,
           $fieldsFullText,
           $yamlFiles,
           function () use ($output) { //callback function to each import
               $output->write(".");
           }
    );

服务

javascript客户端调用的php文件示例。

配置Apache服务器

允许通过同一TCP连接发送多个请求

设置头为Connection Keep-Alive

客户端

使用示例

运行客户端/服务器测试

从命令行启动

vendor\bin\phpunit

待办事项

排名/排序

许可证

GNU 2

联系

作者:Emmanuel ROECKER & Rym BOUCHAGOUR

Web开发博客 - http://dev.glicer.com