Commit b6701925c4d143ab8e1e59d81c083f2c049cbcff

Authored by Andrew Kane
1 parent 30ba080f

Better searchkick_debug method

Showing 1 changed file with 4 additions and 2 deletions   Show diff stats
lib/searchkick/model.rb
... ... @@ -72,15 +72,17 @@ module Searchkick
72 72  
73 73 def searchkick_debug
74 74 require "pp"
  75 + results = search("*", load: false, limit: 3)
75 76 pp ({
76 77 ruby_code: {
77 78 searchkick_options: searchkick_options,
78   - search_data: first(3).map { |r| {index: searchkick_index.record_data(r).merge(data: searchkick_index.send(:search_data, r))}}
  79 + sample_search_data: first(3).map { |r| {index: searchkick_index.record_data(r).merge(data: searchkick_index.send(:search_data, r))}}
79 80 },
80 81 elasticsearch_server: {
81 82 settings: searchkick_index.settings,
82 83 mapping: searchkick_index.mapping,
83   - hits: search("*", load: false, limit: 3).hits
  84 + sample_hits: results.hits,
  85 + total_hits: results.total_count
84 86 }
85 87 })
86 88 nil # do not return anything, as this is strictly used for manual debugging
... ...