On Tue, Feb 08, 2022 at 10:28:21AM +0800, Wu Fengguang wrote:
- def self.search(index, params)
- request_body = JSON.parse(params)
- query = request_body['query'] || {'query' => {}}
- return "index is empty!" if index.nil?
- return "#{index} is not opened" unless OPEN_INDEX.include?(index)
这里的return会在上一级被作为HTTP 200 但看起来是一个错误情况。
是的,抛出错误更好一些。
Thanks, Jihui
- def self.search_by_sql(index, params)
- request_body = JSON.parse(params)
- query = request_body['query']
- return "query table is empty!" if index.nil?
- return "#{index} is not opened" unless OPEN_INDEX.include?(index)
同上。
Thanks, Fengguang