<commit_before>class TreeSearchesController < ApplicationController
  before_filter :authenticate
  
  def show
    names = Node.search(params[:name_string].downcase, params[:tree_id])
    result = []
    names.each do |name|
      result << Node.find_by_name_id(name.id)
    end
    render :json => result.length > 0 ? TreeSearchJsonPresenter.present(result) : { :status => "Nothing found" }
  end

end<commit_msg>Fixed search to return only those names found within tree<commit_after>class TreeSearchesController < ApplicationController
  before_filter :authenticate
  
  def show
    names = Node.search(params[:name_string].downcase, params[:tree_id])
    result = []
    names.each do |name|
      result << Node.find(:first, :conditions => {:name_id => name.id, :tree_id => params[:tree_id]})
    end
    render :json => result.length > 0 ? TreeSearchJsonPresenter.present(result) : { :status => "Nothing found" }
  end

end
{'fraction_non_alphanumeric': 0.11720430107526882, 'fraction_numerical': 0.002150537634408602, 'mean_word_length': 4.1722222222222225, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 12, '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': '1550049', 'n_tokens_mistral': 285, 'n_tokens_neox': 279, 'n_words': 67}