Method: RDoc::Servlet#documentation_search

Defined in:
lib/rdoc/servlet.rb

#documentation_search(store, generator, req, res) ⇒ Object

Creates the JSON search index on res for the given store. generator must respond to #json_index to build. req is ignored.



171
172
173
174
175
176
177
178
179
# File 'lib/rdoc/servlet.rb', line 171

def documentation_search store, generator, req, res
  json_index = @cache[store].fetch :json_index do
    @cache[store][:json_index] =
      JSON.dump generator.json_index.build_index
  end

  res.content_type = 'application/javascript'
  res.body = "var search_data = #{json_index}"
end