I want to create a PHP search function, but using Google-like operators. For instance:
these words "this phrase" location:"Los Angeles" operator:something
It is important that operators like location: support values ββwith spaces in them (hence the quotation marks in this example), so I cannot just split or use standard tokens. I would suggest that someone at some point created a library for this, but I cannot find.
Or, if it does not require a library, a good way to do this would be a good one.
This is just the parsing of the search query I need; that is, from the request above it would be nice to get an array consisting of:
[0] => these [1] => words [2] => "this phrase" [3] => location:"Los Angeles" [4] => operator:something
From this, I can build a search function for the database.
source share