[Lunr] Gravity: adding canonical query
Review Request #785 — Created July 23, 2021 and submitted — Latest diff uploaded
Information | |
---|---|
d.mendes | |
Lunr | |
gravity/database/mysql/canonicalquery | |
cde92c3... | |
Reviewers | |
lunr | |
Gravity: adding canonical query
Thought process,
First approach, i wrote one main loop that it would check each index of the string and choose which path to take depending on character found, my problem with it was that i had to keep verifying previous and next characters with diferent conditions and child loops, so i felt that the code became a bit complex and hard to read.Second approach, functions like strpos can search for more than a single character and this way i can clean up a lot of the conditions, but the problem is that i we'll have multiples loops instead of one main loop to the entire string, and i'm not sure if the impact is noticible or not and in case it is, if it is better to assume it or not, also for numeric values i still used the first approach (with some cases jumping a few ranges) because there was no clear pattern to search for.
Removes Single line comments "#" or "--"
Removes Block comments "/*" and "*/"
Jumps (Ignores) characters in between:
- Executable comments ("/*M","*/") or ("/*!,*/")
- Backquotes "`"
- Escaped caracters "\"Replaces in betweeen characters:
- Double quotes
- Single quotesReplaces finds and replaces numeric characters:
- Numberic "123"
- Negative "-123"
- Decimals "12.34"
- Exponentials "12.34E11" or "12.34E-11"
- Hexadecimals "0x43"Removes:
- End of Line characters
- Excessive blank spaces