I think we're stuck with for loops here. In order to remove them we either need to extend the `WHERE` clause with some boolean logic or use `executemany`. Unfortunately `executemany` only works with `INSERT` and `UPDATE` and any extension of the `WHERE` clause with `OR` will break sorting by relevance. Hopefully this doesn't slow down log parsing, if it does we might need to split this out into a separate task.