A token based query engine using tries to store rules