<commit_before>#collection @models, :root => :results, :object_root => false
#attributes :name => :text, :id => :id

object false

node do |m|
 {:more => false}
end

node do |m|
 {:q => term}
end

node(:results) do
  if @results
    if @results.all.first.respond_to?(:brand)
      @results.map { |o| {
          :text => o.name, :id => o.id, 
          :brand => o.brand.name, :brand_id => o.brand.id
        } }
    else
      @results.map { |o| {:text => o.name, :id => o.id} }
    end
  else<commit_msg>output compatable with results array<commit_after>#collection @models, :root => :results, :object_root => false
#attributes :name => :text, :id => :id

object false

node do |m|
 {:more => false}
end

node do |m|
 {:q => term}
end

node(:results) do
  if @results
    if @results.first.respond_to?(:brand)
      @results.map { |o| {
          :text => o.name, :id => o.id, 
          :brand => o.brand.name, :brand_id => o.brand.id
        } }
    else
      @results.map { |o| {:text => o.name, :id => o.id} }
    end
  else
{'fraction_non_alphanumeric': 0.18525703200775945, 'fraction_numerical': 0.0, 'mean_word_length': 2.5586206896551724, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, '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': '133595', 'n_tokens_mistral': 388, 'n_tokens_neox': 379, 'n_words': 103}