<commit_before>class RecordSearchTerm
  attr_reader :where_clause, :where_args, :order
  def initialize(search_term)
    search_term = search_term.downcase
    @where_clause = ""
    @where_args = {}
    build_field_search(search_term)
  end

  def build_field_search(search_term)
    @where_clause << case_insensitive_search(:description)
    @where_args[:description] = starts_with(search_term)

    @where_clause << " OR #{case_insensitive_search(:title)}"
    @where_args[:title] = starts_with(search_term)

    @order = "title asc"
  end

  def starts_with(search_term)
    search_term + "%"
  end<commit_msg>allow users to search by records that start or end with the input string<commit_after>class RecordSearchTerm
  attr_reader :where_clause, :where_args, :order
  def initialize(search_term)
    search_term = search_term.downcase
    @where_clause = ""
    @where_args = {}
    build_field_search(search_term)
  end

  def build_field_search(search_term)
    @where_clause << case_insensitive_search(:description)
    @where_args[:description] = starts_or_ends_with(search_term)

    @where_clause << " OR #{case_insensitive_search(:title)}"
    @where_args[:title] = starts_or_ends_with(search_term)

    @order = "title asc"
  end

  def starts_or_ends_with(search_term)
    "%" + search_term + "%"
  end
{'fraction_non_alphanumeric': 0.1017463933181473, 'fraction_numerical': 0.0, 'mean_word_length': 4.883928571428571, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, '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': '645995', 'n_tokens_mistral': 445, 'n_tokens_neox': 436, 'n_words': 78}