I would like to be able to enter search strings in my web application (php) similar to google’s style, for example:
- frank
- frank -jones
- created:2010-5-1…2011-6-3 deleted:false
From this I would like a php data structure from which i can build an sql query. The first would search my contact table for “full_name like %frank%”. The second would search it for “full_name like %frank% and not like %jones%”, the third would search for “created between 2010-5-1 and 2011-6-3 and deleted=0”
i believe what i need is a context-free grammer parser. Is there a good one for PHP?
Thanks!
gee, don’t everyone rush in at once…
the answer is: “hey, why don’t you look at the source code for Lucene’s Query Parser? Because it does exactly what you are looking for. In fact, you should just use Lucene, as it’s probably going to be easier.”