MySQL FAQs
FAQs Categories
Client Server Commands
Database Structure
Table Types or Storage Engines
Indexes
SQL Statements
Table Joins
Funtions and Operators
Tricky Select Queries
Speed Up Queries
Data Back Up
General Questions
Errors
1PLs Company - #1Payday.Loans Agency - Loans online and near me $100-$2500 (Same Day)
Powered by MySQL
 
Home / Indexes / Full Text Indexes / Question No: 181

How to use full-text searches with query expansion in MySQL?

I need to use full-text search feature of MySQL but I am not much expert so far.  Some help about Query Expansion  with regard to full-text search is needed.  I would be wonder, if some explanation about usage of full-text searches with query expansion is provided.

Answer No: 181

As of version 4.1.1, MySQL provides WITH QUERY EXPANSION modifier with regard to full-text search  (in particular,   its variant  "blind query expansion"). This is generally   useful when a search phrase is too short, which often means that the user is   relying on implied knowledge that the full-text search engine lacks. For   example, a user searching for "database" may really   mean that "MySQL", "Oracle",   "DB2", "Sybase", and "RDBMS" all are   phrases that should match "databases" and should be   returned, too. This is implied knowledge.

Blind query expansion (also known as automatic relevance feedback) is enabled   by adding WITH QUERY EXPANSION following the search   phrase. It works by performing the search twice, where the search phrase for the   second search is the original search phrase concatenated with the few most   highly relevant documents from the first search. Thus, if one of these documents   contains the word "databases" and the word "MySQL", the second search finds the documents that contain   the word "MySQL" even if they do not contain the word   "database". The following example shows this difference:

SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('database');
+----+-------------------+------------------------------------------+
| id | title             | body                                     |
+----+-------------------+------------------------------------------+
|  5 | MySQL vs. YourSQL | In the following database comparison ... |
|  1 | MySQL Tutorial    | DBMS stands for DataBase ...             |
+----+-------------------+------------------------------------------+
SELECT * FROM articles WHERE MATCH (title,body)
          AGAINST ('database' WITH QUERY EXPANSION);
+----+-------------------+------------------------------------------+
| id | title             | body                                     |
+----+-------------------+------------------------------------------+
|  1 | MySQL Tutorial    | DBMS stands for DataBase ...             |
|  5 | MySQL vs. YourSQL | In the following database comparison ... |
|  3 | Optimizing MySQL  | In this tutorial we will show ...        |
+----+-------------------+------------------------------------------+

Related MySQL FAQs to the Above FAQ

Main-features-and-basic-information-about-full-text-search Main features and basic information about full-text search

What-are-full-text-restrictions-in-MySQL What are full-text restrictions in MySQL?

On-what-data-types-fulltext-index-can-be-created On what data types fulltext index can be created?

How-to-create-full-text-index-in-MySQL How to create full-text index in MySQL?

How-to-create-multi-columns-full-text-index-in-MySQL How to create multi columns full-text index in MySQL?

What-are-natural-language-and-boolean-and-query-expansion-full-text-searches What are natural language and boolean and query expansion full-text searches?

How-to-use-boolean-full-text-search-in-MySQL How to use boolean full-text search in MySQL?

How-to-use-natural-language-full-text-search-in-MySQL How to use natural language full-text search in MySQL?

What-are-stopwords-in-MySQL What are stopwords in MySQL?

About FAQs: Recently Added FAQs

About MySQL FAQs: Site Map | Bookmark Us | Recommend this Site to Your Friend | Contact Us

Useful Links: Wikipedia.org | Oracle.com | w3schools.com | www.php.net | Github.com

© 2023  www.mysqlfaqs.net
All rights reserved.