O'Reilly logo

MySQL 5.1 Plugin Development by Andrew Hutchings, Sergei Golubchik

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A Boolean full-text parser

We know the Boolean syntax of the MySQL built-in full-text parser. MySQL already supports it; there is no fun in reimplementing the same thing. To do something new we could make a parser that supports AND, OR, and NOT keywords, which is supposedly a more user-friendly syntax and our users may like it more than MySQL plus and minus prefixes.

How could our parser support such a syntax? It could, for example, by doing look-ahead, reading the next word before sending the current one to MySQL. If the next word is AND, the current one must have yesno=1. The idea is simple, but the devil, as always, is in the detail:

  • Both words before and after AND must have yesno=1.
  • To support foo AND NOT bar we may need to look two words ahead. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required