Sha256: 43b41687949f1d1f75af4804c2a46e80d561678b59db9f3b38c9d59f85f090d4

Contents?: true

Size: 965 Bytes

Versions: 7

Compression:

Stored size: 965 Bytes

Contents

module RSolr::Ext::Response
  
  autoload :Facets, 'rsolr-ext/response/facets'
  autoload :Docs, 'rsolr-ext/response/docs'
  
  class Base < Mash
    
    def header
      self['responseHeader']
    end
    
    def params
      header['params']
    end
    
    def ok?
      header['status'] == 0
    end
    
  end
  
  # 
  class Standard < Base
    
    def initialize(*args)
      super(*args)
      extend Docs
      extend Facets
    end
    
    def response
      self['response']
    end
    
  end
  
  class Dismax < Standard
    
  end
  
  # 
  class Luke < Base
    
    # Returns an array of fields from the index
    # An optional rule can be used for "grepping" field names:
    # field_list(/_facet$/)
    def field_list(rule=nil)
      fields.select do |k,v|
        rule ? k =~ rule : true
      end.collect{|k,v|k}
    end
    
    def fields
      self['fields']
    end

  end# end Luke
  
  # Update
  class Update < Base
    
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mwmitchell-rsolr-ext-0.6.1 lib/rsolr-ext/response.rb
mwmitchell-rsolr-ext-0.7.10 lib/rsolr-ext/response.rb
mwmitchell-rsolr-ext-0.7.11 lib/rsolr-ext/response.rb
mwmitchell-rsolr-ext-0.7.12 lib/rsolr-ext/response.rb
mwmitchell-rsolr-ext-0.7.2 lib/rsolr-ext/response.rb
mwmitchell-rsolr-ext-0.7.8 lib/rsolr-ext/response.rb
mwmitchell-rsolr-ext-0.7.9 lib/rsolr-ext/response.rb