- for (const Needle &needle : needles) {
- if (needle.str.size() < 3)
- continue;
- parse_trigrams(needle.str, ignore_case, &trigram_groups);
+ if (patterns_are_regex) {
+ // We could parse the regex to find trigrams that have to be there
+ // (there are actually known algorithms to deal with disjunctions
+ // and such, too), but for now, we just go brute force.
+ // Using locate with regexes is pretty niche.
+ } else {
+ for (const Needle &needle : needles) {
+ parse_trigrams(needle.str, ignore_case, &trigram_groups);
+ }