2019-11-18 15:14:26 +01:00
|
|
|
h1 Search
|
|
|
|
|
2024-06-06 22:28:35 +02:00
|
|
|
= form_for :search, ~p"/search", [id: "searchform", method: "get", class: "js-search-form", enforce_utf8: false], fn f ->
|
2024-11-10 03:40:15 +01:00
|
|
|
= text_input f, :q, class: "input input--wide js-search-field", placeholder: "Search terms are chained with commas", autocapitalize: "none", name: "q", value: @conn.params["q"], data: [ac: "true", ac_min_length: 3, ac_mode: "search"]
|
2019-11-18 15:14:26 +01:00
|
|
|
|
|
|
|
.block
|
|
|
|
.block__header.flex
|
|
|
|
a data-search-prepend="-" NOT
|
|
|
|
.dropdown.block__header__dropdown-tab
|
|
|
|
a
|
|
|
|
' Search terms
|
|
|
|
span data-click-preventdefault="true"
|
|
|
|
i.fa.fa-caret-down<
|
|
|
|
.dropdown__content
|
|
|
|
a data-search-add="score.gte:100" data-search-select-last="3" data-search-show-help="numeric" Score
|
|
|
|
a data-search-add="created_at.lte:3 years ago" data-search-select-last="11" data-search-show-help="date" Created at
|
2020-08-13 17:32:35 +02:00
|
|
|
a data-search-add="id.lte:10" data-search-select-last="2" data-search-show-help="numeric" Numeric ID
|
2019-11-18 15:14:26 +01:00
|
|
|
a data-search-add="faves.gte:100" data-search-select-last="3" data-search-show-help="numeric" Number of faves
|
|
|
|
a data-search-add="upvotes.gte:100" data-search-select-last="3" data-search-show-help="numeric" Number of upvotes
|
|
|
|
a data-search-add="downvotes.gte:100" data-search-select-last="3" data-search-show-help="numeric" Number of downvotes
|
|
|
|
a data-search-add="comment_count.gt:20" data-search-select-last="2" data-search-show-help="numeric" Number of comments
|
|
|
|
a data-search-add="uploader:k_a" data-search-select-last="3" data-search-show-help="literal" Uploader
|
2020-08-13 17:32:35 +02:00
|
|
|
a data-search-add="original_format:gif" data-search-select-last="3" data-search-show-help="literal" File extension
|
2024-03-14 14:44:15 +01:00
|
|
|
a data-search-add="file_name:tumblr_*" data-search-select-last="8" data-search-show-help="literal" Original file name
|
2020-08-13 17:32:35 +02:00
|
|
|
a data-search-add="mime_type:image/jpeg" data-search-select-last="10" data-search-show-help="literal" MIME type
|
2019-11-18 15:14:26 +01:00
|
|
|
a data-search-add="source_url:*deviantart.com*" data-search-select-last="16" data-search-show-help="literal" Image source URL
|
|
|
|
a data-search-add="width:1920" data-search-select-last="4" data-search-show-help="numeric" Image width
|
|
|
|
a data-search-add="height:1080" data-search-select-last="4" data-search-show-help="numeric" Image height
|
|
|
|
a data-search-add="aspect_ratio:1" data-search-select-last="1" data-search-show-help="numeric" Aspect ratio
|
2021-12-20 20:44:52 +01:00
|
|
|
a data-search-add="animated:false" data-search-select-last="5" data-search-show-help="boolean" Animated
|
2020-07-22 01:31:55 +02:00
|
|
|
a data-search-add="duration:10" data-search-select-last="2" data-search-show-help="numeric" Duration (seconds)
|
|
|
|
a data-search-add="pixels.gte:5000000" data-search-select-last="7" data-search-show-help="numeric" Pixels
|
|
|
|
a data-search-add="size.lt:1048576" data-search-select-last="7" data-search-show-help="numeric" File size (bytes)
|
2019-11-18 15:14:26 +01:00
|
|
|
|
|
|
|
= if @conn.assigns.current_user do
|
|
|
|
.dropdown.block__header__dropdown-tab
|
|
|
|
a
|
|
|
|
' Belonging to…
|
|
|
|
span data-click-preventdefault="true"
|
|
|
|
i.fa.fa-caret-down<
|
|
|
|
.dropdown__content
|
|
|
|
a data-search-add="my:faves" data-search-show-help=" " My favorites
|
|
|
|
a data-search-add="my:upvotes" data-search-show-help=" " My upvotes
|
|
|
|
a data-search-add="my:uploads" data-search-show-help=" " My uploads
|
|
|
|
a data-search-add="my:watched" data-search-show-help=" " My watched tags
|
2019-11-29 19:26:44 +01:00
|
|
|
.flex__right
|
2019-11-18 15:14:26 +01:00
|
|
|
a href="#" data-click-toggle="#js-search-tags" Quick tags
|
2020-01-01 05:44:28 +01:00
|
|
|
a href="/pages/search_syntax" Help
|
2019-11-18 15:14:26 +01:00
|
|
|
|
|
|
|
.block__content
|
2021-12-20 20:44:52 +01:00
|
|
|
.hidden.walloftext data-search-help="boolean"
|
|
|
|
strong.js-search-help-subject>
|
|
|
|
' is a Boolean-valued field. It only accepts the values
|
|
|
|
code> true
|
|
|
|
' and
|
|
|
|
code false
|
|
|
|
|.
|
|
|
|
br
|
|
|
|
br
|
|
|
|
em<> Example:
|
|
|
|
' to find images which are not animated, you would use
|
|
|
|
code animated:false
|
|
|
|
| .
|
|
|
|
|
2019-11-18 15:14:26 +01:00
|
|
|
.hidden.walloftext data-search-help="numeric"
|
|
|
|
strong.js-search-help-subject>
|
|
|
|
| is a numerical range field. Four qualifiers,
|
|
|
|
code<> gte
|
|
|
|
| (greater than or equal),
|
|
|
|
code<> lte
|
|
|
|
| (less than or equal),
|
|
|
|
code<> gt
|
|
|
|
| (greater than), and
|
|
|
|
code<> lt
|
|
|
|
| (less than), can be applied to the desired value.
|
|
|
|
br
|
|
|
|
br
|
|
|
|
em<> Example:
|
|
|
|
| to find images with a score greater than 100, you would use
|
|
|
|
code<> score.gt:100
|
|
|
|
| .
|
|
|
|
|
|
|
|
.hidden.walloftext data-search-help="date"
|
|
|
|
strong.js-search-help-subject>
|
|
|
|
' is a date/time field. It accepts a
|
2019-11-30 00:54:05 +01:00
|
|
|
a href="/pages/search_syntax#date-range" tweaked subset of the ISO 8601 standard
|
2019-11-18 15:14:26 +01:00
|
|
|
| , as well as relative dates
|
|
|
|
code<
|
|
|
|
| (X minutes/hours/days/months/years ago)
|
|
|
|
| . Four qualifiers,
|
|
|
|
code<> gte
|
|
|
|
| (greater than or equal),
|
|
|
|
code<> lte
|
|
|
|
| (less than or equal),
|
|
|
|
code<> gt
|
|
|
|
| (greater than), and
|
|
|
|
code<> lt
|
|
|
|
| (less than), can be applied to the desired value.
|
|
|
|
br
|
|
|
|
br
|
|
|
|
em<> Example:
|
|
|
|
| to find images created before 2013, you would use
|
|
|
|
code<> created_at.lt:2013
|
|
|
|
| .
|
|
|
|
|
|
|
|
.hidden.walloftext data-search-help="literal"
|
|
|
|
strong.js-search-help-subject>
|
|
|
|
' is a literal field. You can apply apply a wildcard
|
|
|
|
code<> *
|
|
|
|
| as a substitute for zero or more characters.
|
|
|
|
br
|
|
|
|
br
|
|
|
|
em<> Example:
|
|
|
|
| to find images from DeviantArt, you would use
|
|
|
|
code<> source_url:*deviantart.com*
|
|
|
|
| .
|
|
|
|
|
2019-11-29 19:26:44 +01:00
|
|
|
#js-search-tags.hidden
|
|
|
|
.block.js-tagtable data-target=".js-search-field"
|
|
|
|
= PhilomenaWeb.TagView.quick_tags(@conn)
|
2019-11-18 15:14:26 +01:00
|
|
|
|
|
|
|
.field.field--inline.flex-wrap
|
2024-04-28 18:51:40 +02:00
|
|
|
= submit "Search", class: "button button--primary"
|
2019-11-18 15:14:26 +01:00
|
|
|
/= submit_tag "I'm Feeling Poni", class: 'button button--separate-left spacing-right', name: 'random_image'
|
|
|
|
|
|
|
|
elixir:
|
|
|
|
random_is_selected = to_string(@conn.params["sf"]) =~ ~r/\Arandom(:\d+)?\z/
|
2020-08-13 17:32:35 +02:00
|
|
|
|
2019-11-18 15:14:26 +01:00
|
|
|
random_seed =
|
|
|
|
if random_is_selected do
|
|
|
|
@conn.params["sf"]
|
|
|
|
else
|
|
|
|
"random:#{:rand.uniform(4_294_967_296)}"
|
|
|
|
end
|
|
|
|
|
|
|
|
sort_fields = [
|
2022-03-24 17:31:57 +01:00
|
|
|
"Sort by initial post date": :first_seen_at,
|
2020-10-19 21:23:36 +02:00
|
|
|
"Sort by image ID": :id,
|
2019-12-31 23:21:06 +01:00
|
|
|
"Sort by last modification date": :updated_at,
|
|
|
|
"Sort by aspect ratio": :aspect_ratio,
|
|
|
|
"Sort by fave count": :faves,
|
|
|
|
"Sort by upvotes": :upvotes,
|
|
|
|
"Sort by downvotes": :downvotes,
|
2019-11-18 15:14:26 +01:00
|
|
|
"Sort by score": :score,
|
|
|
|
"Sort by Wilson score": :wilson_score,
|
|
|
|
"Sort by relevance": :_score,
|
|
|
|
"Sort by width": :width,
|
|
|
|
"Sort by height": :height,
|
|
|
|
"Sort by comments": :comment_count,
|
|
|
|
"Sort by tag count": :tag_count,
|
2020-07-22 01:31:55 +02:00
|
|
|
"Sort by pixels": :pixels,
|
|
|
|
"Sort by file size": :size,
|
|
|
|
"Sort by duration": :duration,
|
2019-11-18 15:14:26 +01:00
|
|
|
"Random!": random_seed
|
|
|
|
]
|
|
|
|
|
|
|
|
sort_directions = [
|
|
|
|
"Descending": :desc,
|
|
|
|
"Ascending": :asc
|
|
|
|
]
|
|
|
|
|
2019-12-31 00:32:24 +01:00
|
|
|
sort_hidden = [
|
|
|
|
"Exclude Deleted": "",
|
|
|
|
"Include Deleted/Merged": "1",
|
|
|
|
"Deleted Only": "deleted",
|
|
|
|
"Deleted/Merged Only": "only"
|
|
|
|
]
|
|
|
|
|
2019-11-18 15:14:26 +01:00
|
|
|
= select f, :sf, sort_fields, class: "input input--separate-left", name: "sf", autocomplete: "off", selected: @conn.params["sf"]
|
2019-12-31 00:32:24 +01:00
|
|
|
= select f, :sd, sort_directions, class: "input input--separate-left", name: "sd", autocomplete: "off", selected: @conn.params["sd"]
|
|
|
|
|
2021-12-23 03:30:28 +01:00
|
|
|
= if present?(@conn.params["hidden"]) do
|
|
|
|
= hidden_input f, :hidden, name: "hidden", value: @conn.params["hidden"]
|
|
|
|
|
2019-12-31 00:32:24 +01:00
|
|
|
= if hides_images?(@conn) do
|
|
|
|
= select f, :del, sort_hidden, class: "input input--separate-left", name: "del", autocomplete: "off", selected: @conn.params["del"]
|