Some days ago Ocramius talked well about me to a company, that’s really great, but he always leaves to me the work of proving that’s true :P then, here I am, ready to write about a not-so-simple argument: advanced search engine query parsing.
As you know I tried to build a search engine, but when I was 19 of course this argument wasn’t clear in my mind, I understood that it was harder than a regular expression, but how could I know how hard it was? A search query can’t be parsed using regular expressions, for example:
” site:”example.com OR example.net”
This is a not so simple example, but it will show you how hard it can be. Too hard? Let me simplify this query:
site:example.com OR site:example.net
Now it’s simpler than before, but it’s still hard to translate it into a SQL query like this:
SELECT s.* FROM sites s WHERE s.url = "example.com" OR s.url = "example.net" We need something more sophisticated: a parser.