11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

www.it-ebooks.infoCHAPTER 36 • INDEXES AND SEARCHINGensure that results include at least one keyword, all keywords, or no keywords; you are free to exerciseconsiderable filtering control over returned results. Such control is maintained via a number ofrecognized Boolean operators. Several of these operators are presented in Table 36-2.Table 36-2. Full-Text Search Boolean OperatorsOperatorDescription+ A leading plus sign ensures that the ensuing word is present in every result row.– A leading minus sign ensures that the ensuing word is not present in any row returned.* A tailing asterisk allows for keyword variations, provided that the variation begins with thestring specified by the preceding word." " Surrounding double quotes ensure that result rows contain that enclosed string, exactly asit was entered.< > Preceding greater-than and less-than symbols are used to decrease and increase anensuing word’s relevance to the search rankings, respectively.( ) Parentheses are used to group words into subexpressions.Consider a few examples. The first example returns rows containing Apache, but not manual:SELECT name,url FROM bookmarks WHERE MATCH(description)AGAINST('+Apache -manual' in boolean mode);The next example returns rows containing the word Apache, but not Shawnee or Navajo:SELECT name, url FROM bookmarks WHERE MATCH(description)AGAINST('+Apache -Shawnee -Navajo' in boolean mode);The final example returns rows containing web and scripting, or php and scripting, but ranks webscripting lower than php scripting:SELECT name, url FROM bookmarks WHERE MATCH(description)AGAINST('+(php) +scripting');Note that this last example will only work if you lower the ft_min_word_len variable to 3.Indexing Best PracticesThe following list offers a few tips that you should always keep in mind when incorporating indexes intoyour database development strategy:701

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!