<%- url ||= resource_url_proxy.url_for({ action: 'index' }.merge(search_filter_params.except(:q))) -%>

<%= search_form_for @query, url: url, class: 'search_form' do |f| %>
  <div class="search_field">
    <button type="submit">
      <%= render_icon('search') %>
    </button>
    <%= f.search_field resource_handler.search_field_name,
      class: 'search_input_field',
      placeholder: Alchemy.t(:search) %>
    <% local_assigns.fetch(:additional_query_fields, []).each do |field| %>
      <%= f.hidden_field field, id: nil %>
    <% end %>
    <%= link_to render_icon(:times, size: 'xs'), url,
        class: 'search_field_clear',
        id: 'search_field_clear',
        title: Alchemy.t(:click_to_show_all),
        style: search_filter_params.fetch(:q, {}).fetch(resource_handler.search_field_name, '').present? ? 'display: block' : 'display: none' %>
    <% local_assigns.fetch(:additional_params, []).each do |additional_param| %>
      <%= hidden_field_tag additional_param, search_filter_params[additional_param], id: nil %>
    <% end %>
  </div>
<% end %>

<%- url ||= resource_url_proxy.url_for({ action: 'index' }.merge(search_filter_params.except(:q, :page))) -%>

<%= search_form_for @query, url: url, class: 'search_form' do |f| %>
  <div class="search_field">
    <button type="submit">
      <%= render_icon('search') %>
    </button>
    <%= f.search_field resource_handler.search_field_name,
      class: 'search_input_field',
      placeholder: Alchemy.t(:search) %>
    <% local_assigns.fetch(:additional_query_fields, []).each do |field| %>
      <%= f.hidden_field field, id: nil %>
    <% end %>
    <%= link_to render_icon(:times, size: 'xs'), url,
        class: 'search_field_clear',
        id: 'search_field_clear',
        title: Alchemy.t(:click_to_show_all),
        style: search_filter_params.fetch(:q, {}).fetch(resource_handler.search_field_name, '').present? ? 'display: block' : 'display: none' %>
    <% local_assigns.fetch(:additional_params, []).each do |additional_param| %>
      <%= hidden_field_tag additional_param, search_filter_params[additional_param], id: nil %>
    <% end %>
  </div>
<% end %>

Remove page from search form query
Remove page from search form query

We need to reset the page when ever we search, because the result set will be much smaller so pagination needs to be resetted.
