Implementing MySQL dotted search