DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(mysql.info.gz) Fulltext Query Expansion

Info Catalog (mysql.info.gz) Fulltext Boolean (mysql.info.gz) Fulltext Search (mysql.info.gz) Fulltext Restrictions
 
 12.6.2 Full-Text Searches with Query Expansion
 ----------------------------------------------
 
 As of MySQL 4.1.1, full-text search supports query expansion (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
 usually lacks. For example, a user searching for "database" may really
 mean that "MySQL", "Oracle", "DB2", 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
 top found documents from the first search.  Thus, if one of these
 documents contains the word "databases" and the word "MySQL", the
 second search will find the documents that contain the word "MySQL"
 even if they do not contain the word "database".  The following example
 shows this difference:
 
      mysql> 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 ...             |
      +----+-------------------+------------------------------------------+
      2 rows in set (0.00 sec)
 
      mysql> 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 ...        |
      +----+-------------------+------------------------------------------+
      3 rows in set (0.00 sec)
 
 Another example could be searching for books by Georges Simenon about
 Maigret, when a user is not sure how to spell "Maigret". A search for
 "Megre and the reluctant witnesses" will find only "Maigret and the
 Reluctant Witnesses" without query expansion.  A search with query
 expansion will find all books with the word "Maigret" on the second
 pass.
 
 Note: Because blind query expansion tends to increase noise
 significantly by returning non-relevant documents, it's only meaningful
 to use when a search phrase is rather short.
 
Info Catalog (mysql.info.gz) Fulltext Boolean (mysql.info.gz) Fulltext Search (mysql.info.gz) Fulltext Restrictions
automatically generated byinfo2html