Types of fulltext search functions

I do remember my old days when I am new to MySQL and Web industry. At that point of time whenever I have to implement search functionality I was used to implement it via LIKE keyword as below:

SELECT * FROM tbl_name WHERE col_name LIKE “%search_term%”

At that time I am not aware of full-text search. When I explore through Full-Text search I laugh at myself just because of silly stuff I was doing. I found Full-Text search is much powerful, efficient, faster and accurate way to present results of search query.

To perform Full-Text search you need to define indexing on required columns.

There are few constrain to use Full-Text search:

  1. Full-Text index can be used by MyISAM storage engine only
  2. Full-Text index can be defined on CHAR, VARCHAR and TEXT datatype only.
  3. Full-Text index is an index type of FULLTEXT

Basic syntax of  full-text search function is:

MATCH(col1, col2, col3, ….) AGAINST (search_expr [search_modifier])

in above, MATCH takes comma separated column’s name and AGAINT takes string to be searched.

There are three different types of full-text searches available in MySQL

  1. Boolean Search
  2. Natural Language Search
  3. Query Expansion Search
Advertisement

Pages: 1 2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.