<commit_before>class Podio::Search < ActivePodio::Base
  property :type, :string
  property :id, :integer
  property :title, :string
  property :created_on, :datetime
  property :link, :string
  property :space, :hash
  property :org, :hash
  property :app, :hash
  property :search_id, :integer
  property :rank, :integer
  
  has_one :created_by, :class => 'ByLine'
  has_one :app, :class => 'Application'
  has_one :org, :class => 'Organization'
  has_one :space, :class => 'Space'
  
  class << self
    def in_org(org_id, words)
      response = Podio.connection.post do |req|
        req.url "/search/org/#{org_id}/"
        req.body = words
      end

      list response.body
    end

    def globally(words, attributes={})
      attributes[:query] = words
      response = Podio.connection.post do |req|
        req.url "/search/"
        req.body = attributes
      end

      list response.body
    end

    def in_space(space_id, words, attributes={})
      attributes[:query] = words
      response = Podio.connection.post do |req|
        req.url "/search/space/#{space_id}/"
        req.body = attributes
      end

      list response.body
    end

    def in_app(app_id, words, attributes={})<commit_msg>Removed space and org relationship from the search model. Fixes #5608048<commit_after>class Podio::Search < ActivePodio::Base
  property :type, :string
  property :id, :integer
  property :title, :string
  property :created_on, :datetime
  property :link, :string
  property :space, :hash
  property :org, :hash
  property :app, :hash
  property :search_id, :integer
  property :rank, :integer
  
  has_one :created_by, :class => 'ByLine'
  has_one :app, :class => 'Application'

  class << self
    def in_org(org_id, words)
      response = Podio.connection.post do |req|
        req.url "/search/org/#{org_id}/"
        req.body = words
      end

      list response.body
    end

    def globally(words, attributes={})
      attributes[:query] = words
      response = Podio.connection.post do |req|
        req.url "/search/"
        req.body = attributes
      end

      list response.body
    end

    def in_space(space_id, words, attributes={})
      attributes[:query] = words
      response = Podio.connection.post do |req|
        req.url "/search/space/#{space_id}/"
        req.body = attributes
      end

      list response.body
    end

    def in_app(app_id, words, attributes={})
{'fraction_non_alphanumeric': 0.11725846407927333, 'fraction_numerical': 0.002890173410404624, 'mean_word_length': 2.727692307692308, 'pattern_counts': {'":': 0, '<': 9, '<?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': '4708502', 'n_tokens_mistral': 769, 'n_tokens_neox': 749, 'n_words': 211}