Full Text Search In MySQL ,a better way for MySQL Text search

One of the most common issue with MySQL is searching for a matching string from a huge database,suppose we need to search for ‘MySQL Tutorial’ it will only search the occurrence of ‘MySQL Tutorial’ neither ‘MySQL’ or ‘Tutorial’ also in MySQL compared to INT value search Char/Text is time consuming to solve this issue, we have Full Text Search .Full Text Search is a technique used by search engine to find the results in a database.we can use Full Text search in search Query.First you must create a full-text index on the table before you run full-text queries on a table.

Creating a full-text index inside a Table


ALTER TABLE TABLE NAME ADD FULLTEXT (FIELD1, FIELD2,FIELD3, etc)

Example

ALTER TABLE wptt_posts ADD FULLTEXT (`post_title`, `post_content`)

Full Text Search In MySQL

Now we created Full Text Index in wptt_posts table,next we will discuss how to use Full Text Search in MySQL


MySQL Query Using Full Text Search

SELECT * FROM TABLE NAME WHERE MATCH (FILED1FILED2,FILED3) AGAINST ('SEARCH WORD' IN NATURAL LANGUAGE MODE)

Example

SELECT * FROM wptt_posts WHERE MATCH (post_title,post_content) AGAINST ('Mysql Tutorials' IN NATURAL LANGUAGE MODE)
Full Text Search In MySQL 2

We can use the match case based on the Score

SELECT MATCH (post_title,post_content) AGAINST ('Mysql Tutorials') as score, post_title FROM wptt_posts WHERE MATCH (post_title,post_content) AGAINST ('Mysql Tutorials' IN NATURAL LANGUAGE MODE)



Full Text Search In MySQL 3

Where the score value represent the occurrence of search term in the filed

We can skip words (exclude words) from the result

For e.g “-Tutorials” means the search result should not contain Tutorials

SELECT * FROM wptt_posts WHERE MATCH (post_title,post_content) AGAINST ('+Mysql -Tutorials' IN BOOLEAN MODE)


How to install Laravel

Laravel is the one of the most famous PHP web framework, Laravel is a free open-source php framework. Laravel framework is following model–view–controller architectural pattern and based on Symfony, lots of web application using Laravel.It is more secure and fast compared other PHP framework.Lets see how to install Laravel in cPanel

1) Connect to ssh

See How to connect to ssh command prompt using cPanel info

2) Create project directory and download Laravel files to that folder

How to install Laravel in cPanel step 2

3) Move to Laravell folder

 $ cd laravel
 

4) Install Composer

 
 $ composer install
 

How to install Laravel in cPanel step 3

if any version error follow below link

Issue with installing Composer

5) Change you 127.0.0.1 to server ip address

 $ vi vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php

 At the end of it you will find were they are configured:
     protected function getOptions()
    {
        return [
            ['host', null, InputOption::VALUE_OPTIONAL, 'The host address to serve the application on', '127.0.0.1'],
            ['port', null, InputOption::VALUE_OPTIONAL, 'The port to serve the application on', '8000'],
        ];
    }

 change 127.0.0.1 to YOUR_IP_ADDRESS and save the files
 


6) Open php artisan serve and generate key

  $ php artisan serve
  $ php artisan key:generate 
  $ php artisan cache:clear

7) open http://YOUR_IP_ADDRESS :8000/myblog/laravel/.env files and change database and server info

How to install Laravel in cPanel step 4

8) Open http://YOUR_IP_ADDRESS:8000/myblog/laravel/public/install to complete your installation

Features of Laravel

1 ) Template Engine : Laravel has a concept of using Blade Templating ,a templating engine to design a unique layout, All Blade templates should use the .blade.php extension.

2) Security : Most of the php framework facing security issues,but Laravel offers very strong security sytem.

3) Artisan : it is the name of the command line interface included with Laravel ,it has alot of usefull command to clear cache, generate key etc
. php artisan key:generate
. php artisan cache:clear
. php artisan config:cache

4) Database Migration System : Migrations are like version control for your database

5) Unit-Testing : Laravel support Unit-Testing