Prev | Current Page 326 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"


Creating this full-text index enables you to do full-text searches on the indexed fields. To
have phpMyAdmin confirm the existence of the new full-text index, click the Structure tab,
and click the Structure icon for the product table. In the new window, under the Indexes section
(see Figure 8-3), you now see a new index of type FULLTEXT on the name and description
columns.
CHAPTER 8 ?–  SEARCHING THE CATALOG 226
Figure 8-3. The full-text index in phpMyAdmin
?– Tip It??™s worth noting that phpMyAdmin confirms that we have a single FULLTEXT index on two table
columns, rather than two separate FULLTEXT indexes.
Teaching MySQL to Do Any-Words Searches
The generalMySQL syntax for performing a full-text search looks like this:
SELECT
FROM
WHERE MATCH AGAINST
?– Tip The official documentation for the full-text search feature can be found at http://dev.mysql.com/
doc/refman/5.1/en/fulltext-search.html.
CHAPTER 8 ?–  SEARCHING THE CATALOG 227
The column or list of columns on which you do the search must be full-text indexed. If
there is a list of columns, there must be a full-text index that applies to that group of columns,
just as our idx_ft_product_name_description index applies to both name and description.
How can you use this full-text index to perform an any-words search on your products?
Suppose you want to search for the words ???beautiful??? and/or ???flower??? in their (name, description)
pair.


Pages:
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338