class Sunspot::Rails::StubSessionProxy
serach helper
stub solr with “dara” array for testing. if there is no data then it will behave like default blank search this stub uses Kaminari
for pagination once the data is given, solr search block will call search and that will create a new Search
with arguments. With the search, it passes the given data as @operation_context. And “run_proc_block” method will go through each search conditions in the block. while going through the block, it will change @operation_context
Attributes
block[R]
data[R]
range_fields[R]
Public Class Methods
new(original_session, data = [])
click to toggle source
# File lib/stub_solr/stub_session_proxy.rb, line 14 def initialize(original_session, data = []) @original_session = original_session @data = data @range_fields = %w[time month created_at start end] end
Public Instance Methods
search(*types, &block)
click to toggle source
# File lib/stub_solr/stub_session_proxy.rb, line 24 def search(*types, &block) Search.new(@data, types, &block) end
set_range_fields(arr)
click to toggle source
# File lib/stub_solr/stub_session_proxy.rb, line 20 def set_range_fields(arr) @range_fields = arr end