<commit_before>module SearchObject
  module Search
    def self.included(base)
      base.extend ClassMethods
      base.instance_eval do
        @defaults = {}
        @actions  = {}
        @scope    = nil
      end
    end

    def initialize(*args)
      @scope, @filters = self.class.scope_and_filters(args)
    end

    def results
      @results ||= fetch_results
    end

    def results?
      results.any?
    end

    def params(additions = {})
      @filters.merge Helper.stringify_keys(additions)
    end

    private

    def fetch_results<commit_msg>Don't create new Hash if no additional params are given<commit_after>module SearchObject
  module Search
    def self.included(base)
      base.extend ClassMethods
      base.instance_eval do
        @defaults = {}
        @actions  = {}
        @scope    = nil
      end
    end

    def initialize(*args)
      @scope, @filters = self.class.scope_and_filters(args)
    end

    def results
      @results ||= fetch_results
    end

    def results?
      results.any?
    end

    def params(additions = {})
      if additions.empty?
        @filters
      else
        @filters.merge Helper.stringify_keys(additions)
      end
    end

    private

    def fetch_results
{'fraction_non_alphanumeric': 0.07754442649434572, 'fraction_numerical': 0.0, 'mean_word_length': 2.0517241379310347, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7191763', 'n_tokens_mistral': 368, 'n_tokens_neox': 353, 'n_words': 91}