Database Reference
In-Depth Information
also want any other rows that may be related to your search, even if the specific
word anvils is not contained within them.
This is a job for query expansion. When query expansion is used, MariaDB
makes two passes through the data and indexes to perform your search:
First, a basic full-text search is performed to find all rows that match
the search criteria.
Next, MariaDB examines those matched rows and selects all useful
words (we explain how MariaDB figures out what is useful and what is
not shortly).
Then, MariaDB performs the full-text search again, this time using not
just the original criteria, but also all the useful words.
Using query expansion you can therefore find results that might be relevant,
even if they don't contain the exact words for which you were looking.
Here is an example. First, a simple full-text search, without query expansion:
Input
SELECT note_text
FROM productnotes
WHERE Match(note_text) Against('anvils');
Output
+---------------------------------------------------------------------------+
| note_text |
+---------------------------------------------------------------------------+
| Multiple customer returns, anvils failing to drop fast enough or falling |
| backwards on purchaser. Recommend that customer considers using heavier |
| anvils. |
+---------------------------------------------------------------------------+
Analysis
Only one row contains the word anvils , so only one row is returned.
Here is the same search, this time using query expansion:
Input
SELECT note_text
FROM productnotes
WHERE Match(note_text) Against('anvils' WITH QUERY EXPANSION);
Search WWH ::




Custom Search