Class: SearchesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/searches_controller.rb

Instance Method Summary collapse

Instance Method Details

#flushObject



3
4
5
6
# File 'app/controllers/searches_controller.rb', line 3

def flush
  Rifle.flush
  render json: {status: 'success'}, status: :ok
end

#searchObject



15
16
17
18
19
# File 'app/controllers/searches_controller.rb', line 15

def search
  words = params[:q]
  results = Rifle.search(words)
  render json: results, status: :ok
end

#storeObject



8
9
10
11
12
13
# File 'app/controllers/searches_controller.rb', line 8

def store
  urn = params[:urn]
  payload = JSON.parse(request.body.read)
  Rifle.store(urn, payload)
  render json: {status: 'success'}, status: :ok
end