lib/inquisitio/search_url_builder.rb in inquisitio-1.2.4 vs lib/inquisitio/search_url_builder.rb in inquisitio-1.3.0

- old
+ new

@@ -10,19 +10,21 @@ @filters = options[:filters] || {} @arguments = options[:arguments] || {} @return_fields = options[:return_fields] @size = options[:size] || Inquisitio.config.default_search_size @start = options[:start] || 0 + @sort = options[:sort] || {} end def build components = [url_root] is_simple = @filters.empty? && Array(@query).size == 1 components << (is_simple ? simple_query : boolean_query) components << return_fields_query_string components << arguments components << "&size=#{@size}" unless @arguments[:size] components << "&start=#{@start}" unless @arguments[:start] || @start == 0 || @start == '0' + components << '&sort=' + @sort.map {|k,v| "#{k}%20#{v}"}.join(',') unless @sort.empty? components.join("") end private def simple_query