<commit_before>module FbGraph
  module Searchable
    def self.search(query, options = {})
      klass = options.delete(:class) || self
      results = FbGraph::Collection.new(
        Node.new(:search).send(:get, options.merge(:q => query))
      )
      yield results if block_given?
      Result.new(query, klass, options.merge(:results => results))
    end

    def search(query, options = {})
      type = self.to_s.underscore.split('/').last
      FbGraph::Searchable.search(query, options.merge(:type => type)) do |results|
        results.map! do |result|
          self.new(result.delete(:id), result.merge(
            :access_token => options[:access_token]
          ))
        end
      end
    end

    class Result < Collection
      attr_accessor :results

      def initialize(query, klass, options = {})
        @klass = klass
        @query = query
        @options = options
        @results = options[:results] || FbGraph::Collection.new
        replace @results<commit_msg>now search works<commit_after>module FbGraph
  module Searchable
    def self.search(query, options = {})
      klass = options.delete(:class) || FbGraph::Searchable
      results = FbGraph::Collection.new(
        FbGraph::Node.new(:search).send(:get, options.merge(:q => query))
      )
      yield results if block_given?
      FbGraph::Searchable::Result.new(query, klass, options.merge(:results => results))
    end

    def search(query, options = {})
      type = self.to_s.underscore.split('/').last
      FbGraph::Searchable.search(query, options.merge(:type => type, :class => self)) do |results|
        results.map! do |result|
          self.new(result.delete(:id), result.merge(
            :access_token => options[:access_token]
          ))
        end
      end
    end

    class Result < Collection
      attr_accessor :query, :klass, :results, :options

      def initialize(query, klass, options = {})
        @klass = klass
        @query = query
        @options = options
        @results = options[:results] || FbGraph::Collection.new
        replace @results
{'fraction_non_alphanumeric': 0.13076923076923078, 'fraction_numerical': 0.0, 'mean_word_length': 2.5817555938037864, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2981391', 'n_tokens_mistral': 593, 'n_tokens_neox': 599, 'n_words': 134}