tongvanduc / fulltext-search
This package's canonical repository appears to be gone and the package has been frozen as a result.
Requires
- php: ^7.1
This package is auto-updated.
Last update: 2020-12-20 10:04:10 UTC
README
This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.
Installation
You can install the package via composer:
composer require tongvanduc/fulltext-search
Usage
- 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.mysql.com/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();
Example table
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');
Refer document
Tài liệu về Full Text Search - MySQL5.7 - InnoDB
Link 1: https://dev.mysql.com/doc/refman/5.7/en/innodb-fulltext-index.html
Link 2: https://www.w3resource.com/mysql/mysql-full-text-search-functions.php
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email tongduc315@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.