tongvanduc/fulltext-search

此包的官方仓库似乎已不存在,因此该包已被冻结。

dev-master 2020-04-20 08:38 UTC

This package is auto-updated.

Last update: 2020-12-20 10:04:10 UTC


README

Latest Version on Packagist Build Status Quality Score Total Downloads

这里应该是您的描述。尽量限制在一到两段之内,并提及您支持的PSR,以避免与用户和贡献者产生混淆。

安装

您可以通过composer安装此包

composer require tongvanduc/fulltext-search

使用

- Using Trait FullTextSearch vào model cần thực hiện search full text
- Khai báo biến protected static $searchable = [The columns of the full text index] trong model using Trait FullTextSearch

/**
 * Link refer: https://dev.mysqlserver.cn/doc/refman/5.7/en/fulltext-search.html
 *
 * There are four types of full-text searches:
 *
 * 'natural': natural language searches
 * 'natural_with_query': natural language searches with query expansion
 * 'boolean': Boolean Searches
 * 'query': Query expansion searches
 */
ModelClass::search($term = '', $fts = true)->get();

示例表格

Schema::create('full_text_searches', function (Blueprint $table) {
    $table->id('FTS_DOC_ID'); // Nên sử dụng
    $table->string('title');
    $table->string('author');
    $table->text('content');
});

DB::statement('CREATE UNIQUE INDEX FTS_DOC_ID_INDEX on full_text_searches(FTS_DOC_ID)');
DB::statement('ALTER TABLE full_text_searches ADD FULLTEXT fulltext_index(title, author, content)');
DB::statement('ALTER TABLE full_text_searches ENGINE = InnoDB');

参考文档

关于全文搜索的文档 - MySQL5.7 - InnoDB

链接1: https://dev.mysqlserver.cn/doc/refman/5.7/en/innodb-fulltext-index.html

链接2: https://www.w3resource.com/mysql/mysql-full-text-search-functions.php

变更日志

请参阅CHANGELOG以获取有关最近更改的更多信息。

贡献

请参阅CONTRIBUTING以获取详细信息。

安全

如果您发现任何与安全相关的问题,请通过电子邮件tongduc315@gmail.com联系,而不是使用问题跟踪器。

致谢

许可

MIT许可(MIT)。请参阅许可文件以获取更多信息。

Laravel Package Boilerplate

此包是用Laravel Package Boilerplate生成的。