Class: Elastify::ElasticSearchHelper::SearchResultSet

Inherits:
Object
  • Object
show all
Defined in:
lib/elastify/elastic_search_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(elasticsearch_search_result) ⇒ SearchResultSet

Returns a new instance of SearchResultSet.



89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/elastify/elastic_search_helper.rb', line 89

def initialize elasticsearch_search_result
    esr = JSON.parse(elasticsearch_search_result)
    self.scroll_id = esr["_scroll_id"]
    self.took = esr["took"]
    self.timed_out = esr["timed_out"]
    self.shards_total = esr["_shards"]["total"]
    self.shards_successful = esr["_shards"]["successful"]
    self.shards_failed = esr["_shards"]["failed"]
    self.hits_total = esr["hits"]["total"]
    self.hits_maxscore = esr["hits"]["maxscore"]
    self.hits = esr["hits"]["hits"].map{ |hit| SearchResult.new(hit) }
end

Instance Attribute Details

#hitsObject

Returns the value of attribute hits.



88
89
90
# File 'lib/elastify/elastic_search_helper.rb', line 88

def hits
  @hits
end

#hits_maxscoreObject

Returns the value of attribute hits_maxscore.



88
89
90
# File 'lib/elastify/elastic_search_helper.rb', line 88

def hits_maxscore
  @hits_maxscore
end

#hits_totalObject

Returns the value of attribute hits_total.



88
89
90
# File 'lib/elastify/elastic_search_helper.rb', line 88

def hits_total
  @hits_total
end

#scroll_idObject

Returns the value of attribute scroll_id.



88
89
90
# File 'lib/elastify/elastic_search_helper.rb', line 88

def scroll_id
  @scroll_id
end

#shards_failedObject

Returns the value of attribute shards_failed.



88
89
90
# File 'lib/elastify/elastic_search_helper.rb', line 88

def shards_failed
  @shards_failed
end

#shards_successfulObject

Returns the value of attribute shards_successful.



88
89
90
# File 'lib/elastify/elastic_search_helper.rb', line 88

def shards_successful
  @shards_successful
end

#shards_totalObject

Returns the value of attribute shards_total.



88
89
90
# File 'lib/elastify/elastic_search_helper.rb', line 88

def shards_total
  @shards_total
end

#timed_outObject

Returns the value of attribute timed_out.



88
89
90
# File 'lib/elastify/elastic_search_helper.rb', line 88

def timed_out
  @timed_out
end

#tookObject

Returns the value of attribute took.



88
89
90
# File 'lib/elastify/elastic_search_helper.rb', line 88

def took
  @took
end