<commit_before>package main

import (
	"fmt"
	"net/url"
	"strconv"
	"strings"
)

func toUpper(strs []string) []string {
	uppers := []string{}
	for _, s := range strs {
		uppers = append(uppers, strings.ToUpper(s))
	}
	return uppers
}

func toLower(strs []string) []string {
	downers := []string{}
	for _, s := range strs {
		downers = append(downers, strings.ToLower(s))
	}
	return downers
}


type Search struct {
	Conditions []Condition
	Args       url.Values
}

func (s *Search) extractPattern(searchTerm, key string) error {
	or := []Condition{}

	for _, oracle := range s.Args[key] {
		if oracle == "" {
			continue
		}
		if strings.ContainsAny(oracle, "% & _") {
			return fmt.Errorf("Search string can't contain % or _")
		}
		or = append(or, ILike(searchTerm, "%"+oracle+"%"))
	}

	if len(or) > 0 {
		s.Conditions = append(s.Conditions, Or(or...))
	}

	return nil
}

func (s *Search) extractStrings(searchTerm, key string, allowed map[string]bool) error {
	items := s.Args[searchTerm]

	for _, t := range items {
		if !allowed[t] {
			return fmt.Errorf("The %s '%s' is not recognized", key, t)
		}
	}

	return s.addQuery(key, items)
}

func (s *Search) addQuery(key string, items []string) error {
	if len(items) == 0 {
		return nil
	}<commit_msg>Allow spaces in oracle text<commit_after>package main

import (
	"fmt"
	"net/url"
	"strconv"
	"strings"
)

func toUpper(strs []string) []string {
	uppers := []string{}
	for _, s := range strs {
		uppers = append(uppers, strings.ToUpper(s))
	}
	return uppers
}

func toLower(strs []string) []string {
	downers := []string{}
	for _, s := range strs {
		downers = append(downers, strings.ToLower(s))
	}
	return downers
}


type Search struct {
	Conditions []Condition
	Args       url.Values
}

func (s *Search) extractPattern(searchTerm, key string) error {
	or := []Condition{}

	for _, oracle := range s.Args[key] {
		if oracle == "" {
			continue
		}
		if strings.ContainsAny(oracle, "%_") {
			return fmt.Errorf("Search string can't contain '%%' or '_'")
		}
		or = append(or, ILike(searchTerm, "%"+oracle+"%"))
	}

	if len(or) > 0 {
		s.Conditions = append(s.Conditions, Or(or...))
	}

	return nil
}

func (s *Search) extractStrings(searchTerm, key string, allowed map[string]bool) error {
	items := s.Args[searchTerm]

	for _, t := range items {
		if !allowed[t] {
			return fmt.Errorf("The %s '%s' is not recognized", key, t)
		}
	}

	return s.addQuery(key, items)
}


func (s *Search) addQuery(key string, items []string) error {
	if len(items) == 0 {
		return nil
	}
{'fraction_non_alphanumeric': 0.16224772457459438, 'fraction_numerical': 0.0015829046299960427, 'mean_word_length': 3.6814814814814816, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3243277', 'n_tokens_mistral': 987, 'n_tokens_neox': 923, 'n_words': 248}