<commit_before>class RecordsController < ApplicationController

  def index
    search = params[:search]
    
    # if no search term is present
    if search.blank?
      @records = current_user.records
    # else perform full text search by separating key/value by a space
    else
      json_key = search.split(' ')[0]
      json_value = search.split(' ')[1]
      @records = current_user.records.where("to_tsvector(jsonb_extract_path_text(json, ?)) @@ to_tsquery(?)", json_key, json_value).all
    end<commit_msg>allow partial matching off values<commit_after>class RecordsController < ApplicationController

  def index
    search = params[:search]
    
    # if no search term is present
    if search.blank?
      @records = current_user.records
    # else perform full text search by separating key/value by a space
    else
      json_key = search.split(' ')[0]
      json_value = "#{search.split(' ')[1]}:*"
      @records = current_user.records.where("to_tsvector(jsonb_extract_path_text(json, ?)) @@ to_tsquery(?)", json_key, json_value).all
    end
{'fraction_non_alphanumeric': 0.10838831291234684, 'fraction_numerical': 0.003770028275212064, 'mean_word_length': 3.5579399141630903, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5756299', 'n_tokens_mistral': 319, 'n_tokens_neox': 312, 'n_words': 85}