<commit_before>class ProjectContentItem < ActiveRecord::Base
  belongs_to :project

  def base_path
    url.gsub('https://www.gov.uk', '')
  end

  # taxons don't exist
  def taxons
    []
  end

  def mark_complete
    update_attributes(done: true)
  end

  def proxied_url
    url.gsub(%r{https?://(www\.)?gov.uk/}, Proxies::IframeAllowingProxy::PROXY_BASE_PATH)
  end

  scope :uncompleted, -> { where(done: false) }
end
<commit_msg>Add a basic search scope to ProjectContentItem<commit_after>class ProjectContentItem < ActiveRecord::Base
  belongs_to :project

  def base_path
    url.gsub('https://www.gov.uk', '')
  end

  # taxons don't exist
  def taxons
    []
  end

  def mark_complete
    update_attributes(done: true)
  end

  def proxied_url
    url.gsub(%r{https?://(www\.)?gov.uk/}, Proxies::IframeAllowingProxy::PROXY_BASE_PATH)
  end

  scope :uncompleted, -> { where(done: false) }

  scope :matching_search, -> (query) { where("title LIKE ?", "%#{query}%") }
end

{'fraction_non_alphanumeric': 0.13936927772126145, 'fraction_numerical': 0.0, 'mean_word_length': 3.753623188405797, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, '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': '4312926', 'n_tokens_mistral': 364, 'n_tokens_neox': 348, 'n_words': 72}