SlideShare a Scribd company logo
MySQL Full-Text Search Tutorial
— by royalwzy
Personal Profile
More than 5 years experience in database use and management
Proficient in synchronizing data between heterogeneous database
Skilled in designing and optimizing database
Install and configure MySQL cluster and high-availability cluster environment
Synchronize and merge data from Oracle to MySQL
mysqlexp
mysqlclone
Oracle 10g/11g OCM
MySQL 5.6 Database
Administrator
MCITP/MCTS DBA(MSSQL2008)
RHCE
Java Programmer
Oracle ACEA, Oracle Young Expert
ACOUG/SHOUG/OCMU core member
ITPUB Moderator and Community Expert
Senior lecturer in "ENMO" and “UPLOOKING"
Active in OTN & ITPUB and other forums
My blog:royalwzy.com
Table of Contents
❖ MySQL Full-Text Search Introduction
❖ Three Types of Full-Text Searches
❖ MySQL Full-Text Stopwords
❖ Fine-Tuning MySQL Full-Text Search
❖ MySQL Full-Text Restrictions
MySQL Full-Text Search Introduction
❖ Exciting feature
❖ Switch tables to InnoDB
Syntax of Full-Text Searches
MATCH (col1,col2,...) AGAINST (expr [search_modifier])
search_modifier:
{
IN NATURAL LANGUAGE MODE
| IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION
| IN BOOLEAN MODE
| WITH QUERY EXPANSION
}
Three Types of Full-Text Searches
❖ Natural Language Full-Text Searches
❖ Boolean Full-Text Searches
❖ Full-Text Searches with Query Expansion
Natural Language Full-Text Searches
❖ By default or with the IN NATURAL
LANGUAGE MODE modifier
❖ MATCH() returns a relevance value
❖ AGAINST takes a search string and an
optional modifier to search for
Example of Natural Language Full-Text
Searches
What does Last Slide Show?
❖ By default, performed in case-
insensitive fashion(latin1->latin1_bin)
❖ The rows returned are automatically
sorted with the highest relevance first
❖ Relevance is computed based on
❖ The number of words in the row
❖ The number of unique words in that row
❖ The total number of words in the collection
❖ The number of documents (rows) that contain a particular word
Boolean Full-Text Searches
❖ What if you want to
retrieve records that
include word "YourSQL" and
exclude word "MySQL"?
SELECT * FROM articles
WHERE MATCH (title,body)
AGAINST ('+YourSQL -MySQL' IN BOOLEAN MODE);
Operators in Boolean Full-Text Search
❖ (no operator)
❖ +
❖ -
❖ ~
❖ > <
❖ ( )
❖ *
❖ “
❖ @distance
Examples Using Boolean Full-Text Operators
❖ 'apple banana'
❖ '+apple +juice'
❖ '+apple macintosh'
❖ '+apple -macintosh'
❖ '+apple ~macintosh'
❖ '+apple +(>plus <minus)'
❖ 'apple*'
❖ '"some words"'
❖ '"word1 word2 word3" @8'
Quizzes
❖ What is the relevancy ranking of the following
three search strings in row "The Macintosh is
a series of personal computers (PCs) designed,
developed, and marketed by Apple Inc."
❖ Which search string will return more
results?
A:'+apple macintosh’
B:'+apple -macintosh’
C:'+apple ~macintosh’
A:'+word +the*’
B:'+word +the'
How Relevancy Ranking is Calculated
❖ InnoDB full-text search's algorithms
are based on BM25 and TF-IDF ranking
algorithms
❖ TF-IDF(Term Frequency-Inverse
Document Frequency)
❖ May differ from MyISAM relevancy
rankings
How Relevancy Ranking is Calculated
❖ ${TF}
❖ ${IDF} = log10( ${total_records} / $
{matching_records} )
❖ total_records is the number of records in the collection
❖ matching_records is the number of records that the search term appears
in
❖ ${Ranking} = ${TF} * ${IDF} * ${IDF}
Example of Relevancy Ranking for a
Single Word Search
Example of Relevancy Ranking for a
Single Word Search
❖ total_records:8
❖ matching_records:3
❖ ${IDF}=log10(8/3)
❖ ${TF}=6
❖ ${Ranking}=6*log10(8/3)*log10(8/3)
Example of Relevancy Ranking for a
Multiple Word Search
❖ The relevancy ranking value is a sum of
the relevancy ranking value for each word
❖ ${rank} = ${TF} * ${IDF} * ${IDF} + ${TF}
* ${IDF} * ${IDF}
Example of Relevancy Ranking for a
Multiple Word Search
❖ total_records:8
❖ matching_records:6 for "mysql" and 2
for "tutorial"
❖ mysql.${IDF}=log10(8/6),tutorial.${IDF}
=log10(8/2)
❖ mysql.${TF}=1,tutorial.${TF}=2
❖ ${Ranking}=(1*log10(8/6)*log10(8/6))
+(2*log10(8/2)*log10(8/2))
Full-Text Searches with Query Expansion
❖ Full-text search supports query expansion
❖ It's generally useful when a search phrase is
too short
❖ Relying on implied knowledge that the full-
text search engine lacks
❖ Enabled by adding WITH QUERY EXPANSION or IN
NATURAL LANGUAGE MODE WITH QUERY EXPANSION
❖ For example, a user searching for “database”
may really mean that “MySQL”, “Oracle”, “DB2”,
and “RDBMS”
What's is Implied Knowledge?
Example of Query Expansion
MySQL Full-Text Stopwords
❖ Stopwords for InnoDB Search Indexes
❖ INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD table
❖ innodb_ft_server_stopword_table/innodb_ft_user_stopword_table
❖ Stopwords for MyISAM Search Indexes
❖ storage/myisam/ft_static.c
❖ ft_stopword_file
Fine-Tuning MySQL Full-Text Search
❖ Configuring Minimum and Maximum Word
Length
❖ innodb_ft_min_token_size/innodb_ft_max_token_size
❖ ft_min_word_len/ft_max_word_lens
❖ Optimizing InnoDB Full-Text Indexes
❖ set GLOBAL innodb_optimize_fulltext_only=ON;
❖ OPTIMIZE TABLE table_name;
❖ Configuring the Natural Language Search
Threshold
❖ storage/myisam/ftdefs.h
❖ #define GWS_IN_USE GWS_PROB -> #define GWS_IN_USE GWS_FREQ
Case Study
Case Study
MySQL Full-Text Monitor
❖ Tables in INFORMATION_SCHEMA database
❖ Variable:innodb_ft_aux_table
MySQL Full-Text Restrictions
❖ Full-text searches are supported for
InnoDB and MyISAM tables only
❖ Full-text searches are not supported
for partitioned tables
❖ Full-text indexes can be created only
for CHAR, VARCHAR, or TEXT columns
❖ Ideographic languages limitations
MySQL Full-Text Restrictions
❖ All columns in a FULLTEXT index must use
the same character set and collation.
❖ The MATCH() column list must match
exactly the column definited in FULLTEXT
index
❖ The argument to AGAINST() must be a
string value
❖ Index hints are more limited for
FULLTEXT searches than Non-FULLTEXT
Best Practices
❖ Drop FULLTEXT index before load large
data sets
❖ InnoDB Full-Text Plugin
❖ InnoDB N-gram parser
❖ MeCab Parser
“Do NOT alter the MySQL sources unless you know
what you are doing!!!”
Variables for MyISAM
❖ ft_boolean_syntax
❖ ft_max_word_len
❖ ft_min_word_len
❖ ft_query_expansion_limit
❖ ft_stopword_file
Variables for InnoDB
❖ innodb_ft_aux_table
❖ innodb_ft_cache_size
❖ innodb_ft_enable_diag_print
❖ innodb_ft_enable_stopword
❖ innodb_ft_max_token_size
❖ innodb_ft_min_token_size
Variables for InnoDB
❖ innodb_ft_num_word_optimize
❖ innodb_ft_result_cache_limit
❖ innodb_ft_server_stopword_table
❖ innodb_ft_sort_pll_degree
❖ innodb_ft_total_cache_size
❖ innodb_ft_user_stopword_table
❖ innodb_optimize_fulltext_only
Q & A

More Related Content

What's hot

Elasticsearch in 15 minutes
Elasticsearch in 15 minutesElasticsearch in 15 minutes
Elasticsearch in 15 minutes
David Pilato
 
elasticsearch
elasticsearchelasticsearch
elasticsearch
Satish Mohan
 
Introduction to Lucene & Solr and Usecases
Introduction to Lucene & Solr and UsecasesIntroduction to Lucene & Solr and Usecases
Introduction to Lucene & Solr and Usecases
Rahul Jain
 
Exploring Direct Concept Search - Steve Rowe, Lucidworks
Exploring Direct Concept Search - Steve Rowe, LucidworksExploring Direct Concept Search - Steve Rowe, Lucidworks
Exploring Direct Concept Search - Steve Rowe, Lucidworks
Lucidworks
 
A Multifaceted Look At Faceting - Ted Sullivan, Lucidworks
A Multifaceted Look At Faceting - Ted Sullivan, LucidworksA Multifaceted Look At Faceting - Ted Sullivan, Lucidworks
A Multifaceted Look At Faceting - Ted Sullivan, Lucidworks
Lucidworks
 
Introduction to Apache Solr
Introduction to Apache SolrIntroduction to Apache Solr
Introduction to Apache Solr
Alexandre Rafalovitch
 
Building Client-side Search Applications with Solr
Building Client-side Search Applications with SolrBuilding Client-side Search Applications with Solr
Building Client-side Search Applications with Solr
lucenerevolution
 
Webinar: Modern Techniques for Better Search Relevance with Fusion
Webinar: Modern Techniques for Better Search Relevance with FusionWebinar: Modern Techniques for Better Search Relevance with Fusion
Webinar: Modern Techniques for Better Search Relevance with Fusion
Lucidworks
 
Big Data Warehousing Meetup: Developing a super-charged NoSQL data mart using...
Big Data Warehousing Meetup: Developing a super-charged NoSQL data mart using...Big Data Warehousing Meetup: Developing a super-charged NoSQL data mart using...
Big Data Warehousing Meetup: Developing a super-charged NoSQL data mart using...
Caserta
 
Introduction to Cloudera Search Training
Introduction to Cloudera Search TrainingIntroduction to Cloudera Search Training
Introduction to Cloudera Search Training
Cloudera, Inc.
 
How Solr Search Works
How Solr Search WorksHow Solr Search Works
How Solr Search Works
Atlogys Technical Consulting
 
Tutorial on-python-programming
Tutorial on-python-programmingTutorial on-python-programming
Tutorial on-python-programmingChetan Giridhar
 
Solr Architecture
Solr ArchitectureSolr Architecture
Solr Architecture
Ramez Al-Fayez
 
Configuring elasticsearch for performance and scale
Configuring elasticsearch for performance and scaleConfiguring elasticsearch for performance and scale
Configuring elasticsearch for performance and scale
Bharvi Dixit
 
Elasticsearch as a search alternative to a relational database
Elasticsearch as a search alternative to a relational databaseElasticsearch as a search alternative to a relational database
Elasticsearch as a search alternative to a relational database
Kristijan Duvnjak
 
Searching and Querying Knowledge Graphs with Solr/SIREn - A Reference Archite...
Searching and Querying Knowledge Graphs with Solr/SIREn - A Reference Archite...Searching and Querying Knowledge Graphs with Solr/SIREn - A Reference Archite...
Searching and Querying Knowledge Graphs with Solr/SIREn - A Reference Archite...
Lucidworks
 
Semantic & Multilingual Strategies in Lucene/Solr: Presented by Trey Grainger...
Semantic & Multilingual Strategies in Lucene/Solr: Presented by Trey Grainger...Semantic & Multilingual Strategies in Lucene/Solr: Presented by Trey Grainger...
Semantic & Multilingual Strategies in Lucene/Solr: Presented by Trey Grainger...
Lucidworks
 
Elasticsearch
ElasticsearchElasticsearch
Elasticsearch
Ricardo Peres
 
AWS Storage Week - Introduction - Day 2
AWS Storage Week - Introduction - Day 2AWS Storage Week - Introduction - Day 2
AWS Storage Week - Introduction - Day 2
Amazon Web Services
 
Elasticsearch
ElasticsearchElasticsearch
Elasticsearch
Ricardo Peres
 

What's hot (20)

Elasticsearch in 15 minutes
Elasticsearch in 15 minutesElasticsearch in 15 minutes
Elasticsearch in 15 minutes
 
elasticsearch
elasticsearchelasticsearch
elasticsearch
 
Introduction to Lucene & Solr and Usecases
Introduction to Lucene & Solr and UsecasesIntroduction to Lucene & Solr and Usecases
Introduction to Lucene & Solr and Usecases
 
Exploring Direct Concept Search - Steve Rowe, Lucidworks
Exploring Direct Concept Search - Steve Rowe, LucidworksExploring Direct Concept Search - Steve Rowe, Lucidworks
Exploring Direct Concept Search - Steve Rowe, Lucidworks
 
A Multifaceted Look At Faceting - Ted Sullivan, Lucidworks
A Multifaceted Look At Faceting - Ted Sullivan, LucidworksA Multifaceted Look At Faceting - Ted Sullivan, Lucidworks
A Multifaceted Look At Faceting - Ted Sullivan, Lucidworks
 
Introduction to Apache Solr
Introduction to Apache SolrIntroduction to Apache Solr
Introduction to Apache Solr
 
Building Client-side Search Applications with Solr
Building Client-side Search Applications with SolrBuilding Client-side Search Applications with Solr
Building Client-side Search Applications with Solr
 
Webinar: Modern Techniques for Better Search Relevance with Fusion
Webinar: Modern Techniques for Better Search Relevance with FusionWebinar: Modern Techniques for Better Search Relevance with Fusion
Webinar: Modern Techniques for Better Search Relevance with Fusion
 
Big Data Warehousing Meetup: Developing a super-charged NoSQL data mart using...
Big Data Warehousing Meetup: Developing a super-charged NoSQL data mart using...Big Data Warehousing Meetup: Developing a super-charged NoSQL data mart using...
Big Data Warehousing Meetup: Developing a super-charged NoSQL data mart using...
 
Introduction to Cloudera Search Training
Introduction to Cloudera Search TrainingIntroduction to Cloudera Search Training
Introduction to Cloudera Search Training
 
How Solr Search Works
How Solr Search WorksHow Solr Search Works
How Solr Search Works
 
Tutorial on-python-programming
Tutorial on-python-programmingTutorial on-python-programming
Tutorial on-python-programming
 
Solr Architecture
Solr ArchitectureSolr Architecture
Solr Architecture
 
Configuring elasticsearch for performance and scale
Configuring elasticsearch for performance and scaleConfiguring elasticsearch for performance and scale
Configuring elasticsearch for performance and scale
 
Elasticsearch as a search alternative to a relational database
Elasticsearch as a search alternative to a relational databaseElasticsearch as a search alternative to a relational database
Elasticsearch as a search alternative to a relational database
 
Searching and Querying Knowledge Graphs with Solr/SIREn - A Reference Archite...
Searching and Querying Knowledge Graphs with Solr/SIREn - A Reference Archite...Searching and Querying Knowledge Graphs with Solr/SIREn - A Reference Archite...
Searching and Querying Knowledge Graphs with Solr/SIREn - A Reference Archite...
 
Semantic & Multilingual Strategies in Lucene/Solr: Presented by Trey Grainger...
Semantic & Multilingual Strategies in Lucene/Solr: Presented by Trey Grainger...Semantic & Multilingual Strategies in Lucene/Solr: Presented by Trey Grainger...
Semantic & Multilingual Strategies in Lucene/Solr: Presented by Trey Grainger...
 
Elasticsearch
ElasticsearchElasticsearch
Elasticsearch
 
AWS Storage Week - Introduction - Day 2
AWS Storage Week - Introduction - Day 2AWS Storage Week - Introduction - Day 2
AWS Storage Week - Introduction - Day 2
 
Elasticsearch
ElasticsearchElasticsearch
Elasticsearch
 

Viewers also liked

SQL Tuning01-Introduction to SQL Tuning
SQL Tuning01-Introduction to SQL TuningSQL Tuning01-Introduction to SQL Tuning
SQL Tuning01-Introduction to SQL Tuning
Zhaoyang Wang
 
Oracle enterprise manager cloud control 12c release 5 installation on oracle ...
Oracle enterprise manager cloud control 12c release 5 installation on oracle ...Oracle enterprise manager cloud control 12c release 5 installation on oracle ...
Oracle enterprise manager cloud control 12c release 5 installation on oracle ...
Zhaoyang Wang
 
Optimizer operators
Optimizer operatorsOptimizer operators
Optimizer operators
Zhaoyang Wang
 
MYSQLCLONE Introduction
MYSQLCLONE IntroductionMYSQLCLONE Introduction
MYSQLCLONE Introduction
Zhaoyang Wang
 
个人介绍
个人介绍个人介绍
个人介绍
Zhaoyang Wang
 
Installation and configuration 11g r2
Installation and configuration 11g r2Installation and configuration 11g r2
Installation and configuration 11g r2
Zhaoyang Wang
 
SQL Tuning02-Intorduction to the CBO Optimizer
SQL Tuning02-Intorduction to the CBO OptimizerSQL Tuning02-Intorduction to the CBO Optimizer
SQL Tuning02-Intorduction to the CBO Optimizer
Zhaoyang Wang
 
Data Organization in InnoDB
Data Organization in InnoDBData Organization in InnoDB
Data Organization in InnoDB
Zhaoyang Wang
 
Oracle Compute Cloud Service介绍
Oracle Compute Cloud Service介绍Oracle Compute Cloud Service介绍
Oracle Compute Cloud Service介绍
Zhaoyang Wang
 
SQL Tuning04-Interpreting Execution Plans
SQL Tuning04-Interpreting Execution PlansSQL Tuning04-Interpreting Execution Plans
SQL Tuning04-Interpreting Execution Plans
Zhaoyang Wang
 
New awesome features in MySQL 5.7
New awesome features in MySQL 5.7New awesome features in MySQL 5.7
New awesome features in MySQL 5.7
Zhaoyang Wang
 

Viewers also liked (12)

SQL Tuning01-Introduction to SQL Tuning
SQL Tuning01-Introduction to SQL TuningSQL Tuning01-Introduction to SQL Tuning
SQL Tuning01-Introduction to SQL Tuning
 
Oracle enterprise manager cloud control 12c release 5 installation on oracle ...
Oracle enterprise manager cloud control 12c release 5 installation on oracle ...Oracle enterprise manager cloud control 12c release 5 installation on oracle ...
Oracle enterprise manager cloud control 12c release 5 installation on oracle ...
 
Optimizer operators
Optimizer operatorsOptimizer operators
Optimizer operators
 
MYSQLCLONE Introduction
MYSQLCLONE IntroductionMYSQLCLONE Introduction
MYSQLCLONE Introduction
 
个人介绍
个人介绍个人介绍
个人介绍
 
Installation and configuration 11g r2
Installation and configuration 11g r2Installation and configuration 11g r2
Installation and configuration 11g r2
 
Why use MySQL
Why use MySQLWhy use MySQL
Why use MySQL
 
SQL Tuning02-Intorduction to the CBO Optimizer
SQL Tuning02-Intorduction to the CBO OptimizerSQL Tuning02-Intorduction to the CBO Optimizer
SQL Tuning02-Intorduction to the CBO Optimizer
 
Data Organization in InnoDB
Data Organization in InnoDBData Organization in InnoDB
Data Organization in InnoDB
 
Oracle Compute Cloud Service介绍
Oracle Compute Cloud Service介绍Oracle Compute Cloud Service介绍
Oracle Compute Cloud Service介绍
 
SQL Tuning04-Interpreting Execution Plans
SQL Tuning04-Interpreting Execution PlansSQL Tuning04-Interpreting Execution Plans
SQL Tuning04-Interpreting Execution Plans
 
New awesome features in MySQL 5.7
New awesome features in MySQL 5.7New awesome features in MySQL 5.7
New awesome features in MySQL 5.7
 

Similar to MySQL Fulltext Search Tutorial

MYSQL Query Anti-Patterns That Can Be Moved to Sphinx
MYSQL Query Anti-Patterns That Can Be Moved to SphinxMYSQL Query Anti-Patterns That Can Be Moved to Sphinx
MYSQL Query Anti-Patterns That Can Be Moved to Sphinx
Pythian
 
Mysql
MysqlMysql
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
Sencha
 
Database@Home - Data Driven : Loading, Indexing, and Searching with Text and ...
Database@Home - Data Driven : Loading, Indexing, and Searching with Text and ...Database@Home - Data Driven : Loading, Indexing, and Searching with Text and ...
Database@Home - Data Driven : Loading, Indexing, and Searching with Text and ...
Tammy Bednar
 
Using Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 FlowUsing Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 Flow
Karsten Dambekalns
 
PHP and MySQL.pptx
PHP and MySQL.pptxPHP and MySQL.pptx
PHP and MySQL.pptx
natesanp1234
 
MYSQL - PHP Database Connectivity
MYSQL - PHP Database ConnectivityMYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
V.V.Vanniaperumal College for Women
 
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
NoSQLmatters
 
Mysql Fulltext Search 1
Mysql Fulltext Search 1Mysql Fulltext Search 1
Mysql Fulltext Search 1johnymas
 
MySQL Document Store
MySQL Document StoreMySQL Document Store
MySQL Document Store
Mario Beck
 
PHP Oracle
PHP OraclePHP Oracle
PHP Oracle
Nur Hidayat
 
Introduction to Azure Data Lake
Introduction to Azure Data LakeIntroduction to Azure Data Lake
Introduction to Azure Data Lake
Antonios Chatzipavlis
 
An Introduction to Elastic Search.
An Introduction to Elastic Search.An Introduction to Elastic Search.
An Introduction to Elastic Search.
Jurriaan Persyn
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBJustin Smestad
 
ElasticSearch for .NET Developers
ElasticSearch for .NET DevelopersElasticSearch for .NET Developers
ElasticSearch for .NET Developers
Ben van Mol
 
Use Performance Insights To Enhance MongoDB Performance - (Manosh Malai - Myd...
Use Performance Insights To Enhance MongoDB Performance - (Manosh Malai - Myd...Use Performance Insights To Enhance MongoDB Performance - (Manosh Malai - Myd...
Use Performance Insights To Enhance MongoDB Performance - (Manosh Malai - Myd...
Mydbops
 
Php workshop L04 database
Php workshop L04 databasePhp workshop L04 database
Php workshop L04 database
Mohammad Tahsin Alshalabi
 
Presentation: mongo db & elasticsearch & membase
Presentation: mongo db & elasticsearch & membasePresentation: mongo db & elasticsearch & membase
Presentation: mongo db & elasticsearch & membase
Ardak Shalkarbayuli
 
HPCC Systems vs Hadoop
HPCC Systems vs HadoopHPCC Systems vs Hadoop
HPCC Systems vs Hadoop
Fujio Turner
 
Introducing U-SQL (SQLPASS 2016)
Introducing U-SQL (SQLPASS 2016)Introducing U-SQL (SQLPASS 2016)
Introducing U-SQL (SQLPASS 2016)
Michael Rys
 

Similar to MySQL Fulltext Search Tutorial (20)

MYSQL Query Anti-Patterns That Can Be Moved to Sphinx
MYSQL Query Anti-Patterns That Can Be Moved to SphinxMYSQL Query Anti-Patterns That Can Be Moved to Sphinx
MYSQL Query Anti-Patterns That Can Be Moved to Sphinx
 
Mysql
MysqlMysql
Mysql
 
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
 
Database@Home - Data Driven : Loading, Indexing, and Searching with Text and ...
Database@Home - Data Driven : Loading, Indexing, and Searching with Text and ...Database@Home - Data Driven : Loading, Indexing, and Searching with Text and ...
Database@Home - Data Driven : Loading, Indexing, and Searching with Text and ...
 
Using Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 FlowUsing Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 Flow
 
PHP and MySQL.pptx
PHP and MySQL.pptxPHP and MySQL.pptx
PHP and MySQL.pptx
 
MYSQL - PHP Database Connectivity
MYSQL - PHP Database ConnectivityMYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
 
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
 
Mysql Fulltext Search 1
Mysql Fulltext Search 1Mysql Fulltext Search 1
Mysql Fulltext Search 1
 
MySQL Document Store
MySQL Document StoreMySQL Document Store
MySQL Document Store
 
PHP Oracle
PHP OraclePHP Oracle
PHP Oracle
 
Introduction to Azure Data Lake
Introduction to Azure Data LakeIntroduction to Azure Data Lake
Introduction to Azure Data Lake
 
An Introduction to Elastic Search.
An Introduction to Elastic Search.An Introduction to Elastic Search.
An Introduction to Elastic Search.
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
ElasticSearch for .NET Developers
ElasticSearch for .NET DevelopersElasticSearch for .NET Developers
ElasticSearch for .NET Developers
 
Use Performance Insights To Enhance MongoDB Performance - (Manosh Malai - Myd...
Use Performance Insights To Enhance MongoDB Performance - (Manosh Malai - Myd...Use Performance Insights To Enhance MongoDB Performance - (Manosh Malai - Myd...
Use Performance Insights To Enhance MongoDB Performance - (Manosh Malai - Myd...
 
Php workshop L04 database
Php workshop L04 databasePhp workshop L04 database
Php workshop L04 database
 
Presentation: mongo db & elasticsearch & membase
Presentation: mongo db & elasticsearch & membasePresentation: mongo db & elasticsearch & membase
Presentation: mongo db & elasticsearch & membase
 
HPCC Systems vs Hadoop
HPCC Systems vs HadoopHPCC Systems vs Hadoop
HPCC Systems vs Hadoop
 
Introducing U-SQL (SQLPASS 2016)
Introducing U-SQL (SQLPASS 2016)Introducing U-SQL (SQLPASS 2016)
Introducing U-SQL (SQLPASS 2016)
 

More from Zhaoyang Wang

海通证券金融云思考与实践(数据技术嘉年华2017)
海通证券金融云思考与实践(数据技术嘉年华2017)海通证券金融云思考与实践(数据技术嘉年华2017)
海通证券金融云思考与实践(数据技术嘉年华2017)
Zhaoyang Wang
 
云管理平台助力海通金融云建设
云管理平台助力海通金融云建设云管理平台助力海通金融云建设
云管理平台助力海通金融云建设
Zhaoyang Wang
 
海通证券数据库备份恢复云平台实践(OTN Tour Shanghai 2017)
海通证券数据库备份恢复云平台实践(OTN Tour Shanghai 2017)海通证券数据库备份恢复云平台实践(OTN Tour Shanghai 2017)
海通证券数据库备份恢复云平台实践(OTN Tour Shanghai 2017)
Zhaoyang Wang
 
Oracle Compute Cloud Service快速实践
Oracle Compute Cloud Service快速实践Oracle Compute Cloud Service快速实践
Oracle Compute Cloud Service快速实践
Zhaoyang Wang
 
Oracle cloud 使用云市场快速搭建小型电商网站
Oracle cloud 使用云市场快速搭建小型电商网站Oracle cloud 使用云市场快速搭建小型电商网站
Oracle cloud 使用云市场快速搭建小型电商网站
Zhaoyang Wang
 
Oracle cloud ravello介绍及测试账户申请
Oracle cloud ravello介绍及测试账户申请Oracle cloud ravello介绍及测试账户申请
Oracle cloud ravello介绍及测试账户申请
Zhaoyang Wang
 
Oracle cloud 云介绍及测试账户申请
Oracle cloud 云介绍及测试账户申请Oracle cloud 云介绍及测试账户申请
Oracle cloud 云介绍及测试账户申请
Zhaoyang Wang
 
Performance Tuning Tool01-Statspack
Performance Tuning Tool01-StatspackPerformance Tuning Tool01-Statspack
Performance Tuning Tool01-Statspack
Zhaoyang Wang
 
Oracle enterprise manager cloud control 12c r5 agent installation
Oracle enterprise manager cloud control 12c r5 agent installationOracle enterprise manager cloud control 12c r5 agent installation
Oracle enterprise manager cloud control 12c r5 agent installation
Zhaoyang Wang
 
Oracle security 08-oracle network security
Oracle security 08-oracle network securityOracle security 08-oracle network security
Oracle security 08-oracle network security
Zhaoyang Wang
 
Oracle security 02-administering user security
Oracle security 02-administering user securityOracle security 02-administering user security
Oracle security 02-administering user security
Zhaoyang Wang
 
Interpreting execution plans
Interpreting execution plansInterpreting execution plans
Interpreting execution plans
Zhaoyang Wang
 
Intorduction to the cbo optimizer
Intorduction to the cbo optimizerIntorduction to the cbo optimizer
Intorduction to the cbo optimizer
Zhaoyang Wang
 
Installation and configuration 11g r2 asm using job role separation(grid & or...
Installation and configuration 11g r2 asm using job role separation(grid & or...Installation and configuration 11g r2 asm using job role separation(grid & or...
Installation and configuration 11g r2 asm using job role separation(grid & or...
Zhaoyang Wang
 

More from Zhaoyang Wang (14)

海通证券金融云思考与实践(数据技术嘉年华2017)
海通证券金融云思考与实践(数据技术嘉年华2017)海通证券金融云思考与实践(数据技术嘉年华2017)
海通证券金融云思考与实践(数据技术嘉年华2017)
 
云管理平台助力海通金融云建设
云管理平台助力海通金融云建设云管理平台助力海通金融云建设
云管理平台助力海通金融云建设
 
海通证券数据库备份恢复云平台实践(OTN Tour Shanghai 2017)
海通证券数据库备份恢复云平台实践(OTN Tour Shanghai 2017)海通证券数据库备份恢复云平台实践(OTN Tour Shanghai 2017)
海通证券数据库备份恢复云平台实践(OTN Tour Shanghai 2017)
 
Oracle Compute Cloud Service快速实践
Oracle Compute Cloud Service快速实践Oracle Compute Cloud Service快速实践
Oracle Compute Cloud Service快速实践
 
Oracle cloud 使用云市场快速搭建小型电商网站
Oracle cloud 使用云市场快速搭建小型电商网站Oracle cloud 使用云市场快速搭建小型电商网站
Oracle cloud 使用云市场快速搭建小型电商网站
 
Oracle cloud ravello介绍及测试账户申请
Oracle cloud ravello介绍及测试账户申请Oracle cloud ravello介绍及测试账户申请
Oracle cloud ravello介绍及测试账户申请
 
Oracle cloud 云介绍及测试账户申请
Oracle cloud 云介绍及测试账户申请Oracle cloud 云介绍及测试账户申请
Oracle cloud 云介绍及测试账户申请
 
Performance Tuning Tool01-Statspack
Performance Tuning Tool01-StatspackPerformance Tuning Tool01-Statspack
Performance Tuning Tool01-Statspack
 
Oracle enterprise manager cloud control 12c r5 agent installation
Oracle enterprise manager cloud control 12c r5 agent installationOracle enterprise manager cloud control 12c r5 agent installation
Oracle enterprise manager cloud control 12c r5 agent installation
 
Oracle security 08-oracle network security
Oracle security 08-oracle network securityOracle security 08-oracle network security
Oracle security 08-oracle network security
 
Oracle security 02-administering user security
Oracle security 02-administering user securityOracle security 02-administering user security
Oracle security 02-administering user security
 
Interpreting execution plans
Interpreting execution plansInterpreting execution plans
Interpreting execution plans
 
Intorduction to the cbo optimizer
Intorduction to the cbo optimizerIntorduction to the cbo optimizer
Intorduction to the cbo optimizer
 
Installation and configuration 11g r2 asm using job role separation(grid & or...
Installation and configuration 11g r2 asm using job role separation(grid & or...Installation and configuration 11g r2 asm using job role separation(grid & or...
Installation and configuration 11g r2 asm using job role separation(grid & or...
 

Recently uploaded

PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 

Recently uploaded (20)

PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 

MySQL Fulltext Search Tutorial

  • 1. MySQL Full-Text Search Tutorial — by royalwzy
  • 2. Personal Profile More than 5 years experience in database use and management Proficient in synchronizing data between heterogeneous database Skilled in designing and optimizing database Install and configure MySQL cluster and high-availability cluster environment Synchronize and merge data from Oracle to MySQL mysqlexp mysqlclone Oracle 10g/11g OCM MySQL 5.6 Database Administrator MCITP/MCTS DBA(MSSQL2008) RHCE Java Programmer Oracle ACEA, Oracle Young Expert ACOUG/SHOUG/OCMU core member ITPUB Moderator and Community Expert Senior lecturer in "ENMO" and “UPLOOKING" Active in OTN & ITPUB and other forums My blog:royalwzy.com
  • 3. Table of Contents ❖ MySQL Full-Text Search Introduction ❖ Three Types of Full-Text Searches ❖ MySQL Full-Text Stopwords ❖ Fine-Tuning MySQL Full-Text Search ❖ MySQL Full-Text Restrictions
  • 4. MySQL Full-Text Search Introduction ❖ Exciting feature ❖ Switch tables to InnoDB
  • 5. Syntax of Full-Text Searches MATCH (col1,col2,...) AGAINST (expr [search_modifier]) search_modifier: { IN NATURAL LANGUAGE MODE | IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION | IN BOOLEAN MODE | WITH QUERY EXPANSION }
  • 6. Three Types of Full-Text Searches ❖ Natural Language Full-Text Searches ❖ Boolean Full-Text Searches ❖ Full-Text Searches with Query Expansion
  • 7. Natural Language Full-Text Searches ❖ By default or with the IN NATURAL LANGUAGE MODE modifier ❖ MATCH() returns a relevance value ❖ AGAINST takes a search string and an optional modifier to search for
  • 8. Example of Natural Language Full-Text Searches
  • 9. What does Last Slide Show? ❖ By default, performed in case- insensitive fashion(latin1->latin1_bin) ❖ The rows returned are automatically sorted with the highest relevance first ❖ Relevance is computed based on ❖ The number of words in the row ❖ The number of unique words in that row ❖ The total number of words in the collection ❖ The number of documents (rows) that contain a particular word
  • 10. Boolean Full-Text Searches ❖ What if you want to retrieve records that include word "YourSQL" and exclude word "MySQL"? SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL -MySQL' IN BOOLEAN MODE);
  • 11. Operators in Boolean Full-Text Search ❖ (no operator) ❖ + ❖ - ❖ ~ ❖ > < ❖ ( ) ❖ * ❖ “ ❖ @distance
  • 12. Examples Using Boolean Full-Text Operators ❖ 'apple banana' ❖ '+apple +juice' ❖ '+apple macintosh' ❖ '+apple -macintosh' ❖ '+apple ~macintosh' ❖ '+apple +(>plus <minus)' ❖ 'apple*' ❖ '"some words"' ❖ '"word1 word2 word3" @8'
  • 13. Quizzes ❖ What is the relevancy ranking of the following three search strings in row "The Macintosh is a series of personal computers (PCs) designed, developed, and marketed by Apple Inc." ❖ Which search string will return more results? A:'+apple macintosh’ B:'+apple -macintosh’ C:'+apple ~macintosh’ A:'+word +the*’ B:'+word +the'
  • 14. How Relevancy Ranking is Calculated ❖ InnoDB full-text search's algorithms are based on BM25 and TF-IDF ranking algorithms ❖ TF-IDF(Term Frequency-Inverse Document Frequency) ❖ May differ from MyISAM relevancy rankings
  • 15. How Relevancy Ranking is Calculated ❖ ${TF} ❖ ${IDF} = log10( ${total_records} / $ {matching_records} ) ❖ total_records is the number of records in the collection ❖ matching_records is the number of records that the search term appears in ❖ ${Ranking} = ${TF} * ${IDF} * ${IDF}
  • 16. Example of Relevancy Ranking for a Single Word Search
  • 17. Example of Relevancy Ranking for a Single Word Search ❖ total_records:8 ❖ matching_records:3 ❖ ${IDF}=log10(8/3) ❖ ${TF}=6 ❖ ${Ranking}=6*log10(8/3)*log10(8/3)
  • 18. Example of Relevancy Ranking for a Multiple Word Search ❖ The relevancy ranking value is a sum of the relevancy ranking value for each word ❖ ${rank} = ${TF} * ${IDF} * ${IDF} + ${TF} * ${IDF} * ${IDF}
  • 19. Example of Relevancy Ranking for a Multiple Word Search ❖ total_records:8 ❖ matching_records:6 for "mysql" and 2 for "tutorial" ❖ mysql.${IDF}=log10(8/6),tutorial.${IDF} =log10(8/2) ❖ mysql.${TF}=1,tutorial.${TF}=2 ❖ ${Ranking}=(1*log10(8/6)*log10(8/6)) +(2*log10(8/2)*log10(8/2))
  • 20. Full-Text Searches with Query Expansion ❖ Full-text search supports query expansion ❖ It's generally useful when a search phrase is too short ❖ Relying on implied knowledge that the full- text search engine lacks ❖ Enabled by adding WITH QUERY EXPANSION or IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION ❖ For example, a user searching for “database” may really mean that “MySQL”, “Oracle”, “DB2”, and “RDBMS”
  • 21. What's is Implied Knowledge?
  • 22. Example of Query Expansion
  • 23. MySQL Full-Text Stopwords ❖ Stopwords for InnoDB Search Indexes ❖ INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD table ❖ innodb_ft_server_stopword_table/innodb_ft_user_stopword_table ❖ Stopwords for MyISAM Search Indexes ❖ storage/myisam/ft_static.c ❖ ft_stopword_file
  • 24. Fine-Tuning MySQL Full-Text Search ❖ Configuring Minimum and Maximum Word Length ❖ innodb_ft_min_token_size/innodb_ft_max_token_size ❖ ft_min_word_len/ft_max_word_lens ❖ Optimizing InnoDB Full-Text Indexes ❖ set GLOBAL innodb_optimize_fulltext_only=ON; ❖ OPTIMIZE TABLE table_name; ❖ Configuring the Natural Language Search Threshold ❖ storage/myisam/ftdefs.h ❖ #define GWS_IN_USE GWS_PROB -> #define GWS_IN_USE GWS_FREQ
  • 27. MySQL Full-Text Monitor ❖ Tables in INFORMATION_SCHEMA database ❖ Variable:innodb_ft_aux_table
  • 28. MySQL Full-Text Restrictions ❖ Full-text searches are supported for InnoDB and MyISAM tables only ❖ Full-text searches are not supported for partitioned tables ❖ Full-text indexes can be created only for CHAR, VARCHAR, or TEXT columns ❖ Ideographic languages limitations
  • 29. MySQL Full-Text Restrictions ❖ All columns in a FULLTEXT index must use the same character set and collation. ❖ The MATCH() column list must match exactly the column definited in FULLTEXT index ❖ The argument to AGAINST() must be a string value ❖ Index hints are more limited for FULLTEXT searches than Non-FULLTEXT
  • 30. Best Practices ❖ Drop FULLTEXT index before load large data sets ❖ InnoDB Full-Text Plugin ❖ InnoDB N-gram parser ❖ MeCab Parser “Do NOT alter the MySQL sources unless you know what you are doing!!!”
  • 31. Variables for MyISAM ❖ ft_boolean_syntax ❖ ft_max_word_len ❖ ft_min_word_len ❖ ft_query_expansion_limit ❖ ft_stopword_file
  • 32. Variables for InnoDB ❖ innodb_ft_aux_table ❖ innodb_ft_cache_size ❖ innodb_ft_enable_diag_print ❖ innodb_ft_enable_stopword ❖ innodb_ft_max_token_size ❖ innodb_ft_min_token_size
  • 33. Variables for InnoDB ❖ innodb_ft_num_word_optimize ❖ innodb_ft_result_cache_limit ❖ innodb_ft_server_stopword_table ❖ innodb_ft_sort_pll_degree ❖ innodb_ft_total_cache_size ❖ innodb_ft_user_stopword_table ❖ innodb_optimize_fulltext_only
  • 34. Q & A