commit e673075abdcb67695556e0cc7fe7b002adb68b1b
parent ecb7841ea43806d17e4e889f98e74bf6a9397f06
Author: breadcat <breadcat@users.noreply.github.com>
Date: Fri, 10 Apr 2026 08:26:26 +0100
Changing case of whole query silently failed
Diffstat:
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/include-bulk.go b/include-bulk.go
@@ -355,10 +355,24 @@ func getFileIDsFromANDQuery(query string) ([]int, error) {
// getFileIDsFromORQuery handles OR-separated tags
func getFileIDsFromORQuery(query string) ([]int, error) {
- tagPairs := strings.Split(strings.ToUpper(query), " OR ")
- var tags []TagPair
+ // Split on " OR " case-insensitively by working on the uppercased copy for
+ // index finding, but extracting substrings from the original query.
+ upperQuery := strings.ToUpper(query)
+ const sep = " OR "
+ var rawPairs []string
+ start := 0
+ for {
+ idx := strings.Index(upperQuery[start:], sep)
+ if idx < 0 {
+ rawPairs = append(rawPairs, query[start:])
+ break
+ }
+ rawPairs = append(rawPairs, query[start:start+idx])
+ start += idx + len(sep)
+ }
- for _, pair := range tagPairs {
+ var tags []TagPair
+ for _, pair := range rawPairs {
pair = strings.TrimSpace(pair)
if pair == "" {
continue