so when clients are logged into the app they should only be able to search within their company so we are trying to filter on client name. The log output appears to be correct though but no search results are being returned.
#report.rb
def self.search_for_client(params, client)
tire.search(load: true, page: params[:page], per_page: 20) do
query { string params[:q] } if params[:q].present?
filter :term, :client => client
end
end
#reports_controller.rb
def full_search
@query = params[:q]
if current_user.client.nil?
@results = Report.search params
else
@results = Report.search_for_client params, current_user.client.title
end
end
#log output
curl -X GET 'http://localhost:9200/reports/report/_search?load=true&size=20&pretty' -d '{"query":{"query_string":{"query":"thio"}},"filter":{"term":{"client":"ApplusRTD Norway"}},"size":20}'