<commit_before>class Spree::SuggestionsController < Spree::BaseController

  def index
    suggestions = Spree::Suggestion.relevant(params['term'])

    if request.xhr?
      render :json => suggestions.collect{|s| {:keywords => s.keywords, :url => eval(s.data)[:url]}}
    else
      render_404
    end
  end<commit_msg>fix a bug when data column is blank<commit_after>class Spree::SuggestionsController < Spree::BaseController

  def index
    suggestions = Spree::Suggestion.relevant(params['term'])

    if request.xhr?
      render :json => suggestions.collect{|s| {:keywords => s.keywords, :url => !s.data.blank? && eval(s.data).has_key?("url") ? eval(s.data)[:url] : ""}}
    else
      render_404
    end
  end
{'fraction_non_alphanumeric': 0.149025069637883, 'fraction_numerical': 0.008356545961002786, 'mean_word_length': 3.9930555555555554, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '6263463', 'n_tokens_mistral': 244, 'n_tokens_neox': 223, 'n_words': 48}