Files
danbooru/app/views/pool_versions/search.html.erb
evazion 29a4ca0818 pools: switch from search[name_matches] to search[name_contains].
The previous commit changed it so that `/pools?search[name_matches]`
does a full-text search. So for example, `search[name_matches]=smiling`
will now match pool names containing any of the words "smiling",
"smile", "smiles", or "smiled".

This commit adds a `/pools?search[name_contains]` param that does what
`name_matches` did before, and switches to it in search forms. So for
example, `search[name_contains]=smiling` will only match pool names
containing the exact substring "smiling".

This change is so that `<field>_matches` works consistently across the
site, and so that it's possible to search pool names by either an exact
substring match, or by a looser natural language match.

This is a minor breaking API change. API users can replace
`/pools?search[name_matches]` with `/pools?search[name_contains]` to get
the same behavior as before. The same applies to /favorite_groups.
2022-09-22 01:52:13 -05:00

19 lines
1.1 KiB
Plaintext

<div id="c-pool-versions">
<div id="a-search">
<h1>Search Changes</h1>
<%= search_form_for(pool_versions_path) do |f| %>
<%= f.input :updater_name, label: "Updater", input_html: { value: params.dig(:search, :updater_name), "data-autocomplete": "user" } %>
<%= f.input :name_contains, label: "Pool", input_html: { value: params.dig(:search, :name_contains), "data-autocomplete": "pool" } %>
<%= f.input :category, label: "Category", collection: [["Series", "series"], ["Collection", "collection"]], include_blank: true %>
<%= f.input :is_new, label: "New?", collection: [["Yes", true], ["No", false]], include_blank: true %>
<%= f.input :name_changed, label: "Name changed?", collection: [["Yes", true], ["No", false]], include_blank: true %>
<%= f.input :description_changed, label: "Description changed?", collection: [["Yes", true], ["No", false]], include_blank: true %>
<%= f.input :is_deleted, label: "Deleted?", collection: [["Yes", true], ["No", false]], include_blank: true %>
<%= f.submit "Search" %>
<% end %>
</div>
</div>
<%= render "secondary_links" %>