<commit_before>= render 'search/breadcrumbs'

%table.search-collapsible
  %thead
    %tr
      %th.search-params-header
        Search Replies
        - if @search_results
          = '- '+@search_results.total_entries.to_s+' results'
      %th.search-results-header
        - if @search_results
          = render 'posts/paginator', paginated: @search_results, no_per: true
  %tbody
    %tr
      %td.search-box
        = form_tag search_replies_path, :method => :get do
          %table.search-form
            %tr
              %td{style: 'width: 80px;'}= label_tag :board_id, 'Continuity'
              %td
                - if @post
                  %b= @post.board.name
                - else
                  = select_tag :board_id, options_from_collection_for_select(@boards || [], :id, :name, params[:board_id]), {class: 'chosen-select', prompt: '— Choose Continuity —'}
            %tr
              %td= label_tag :author_id, 'Author'
              %td= select_tag :author_id, options_from_collection_for_select(@users || [], :id, :username, params[:author_id]), {class: 'chosen-select', prompt: '— Choose Author —'}
            %tr
              %td= label_tag :template_id, 'Template'
              %td= select_tag :template_id, options_from_collection_for_select(@templates, :id, :name, params[:template_id]), {class: 'chosen-select', prompt: '— Choose Template —'}
            %tr
              %td= label_tag :character_id, 'Character'
              %td= select_tag :character_id, options_from_collection_for_select(@characters || [], :id, :selector_name, params[:character_id]), {prompt: '— Choose Character —'}
            %tr
              %td= label_tag :subj_content, 'Content'
              %td= text_field_tag :subj_content, params[:subj_content], style: 'width: 100%; margin: 5px 0px;'
            %tr
              %td= label_tag :sort, 'Sort'
              %td= select_tag :sort, options_for_select([['Best match', 'rank'], ['Newest first', 'created_new'], ['Oldest first', 'created_old']], params[:sort]), {class: 'chosen-select'}
            - if @post.present?
              %tr
                %td Post
                %td
                  %b= @post.subject
                  = hidden_field_tag :post_id, @post.id
            - if @icon
              %tr
                %td= label_tag :icon_id, 'Icon'
                %td
                  = icon_tag @icon, class: 'preview-icon search-icon-preview'
                  %span.search-icon-keyword= @icon.keyword
            %tr
              %td= label_tag :condensed, 'Condensed'
              %td
                = check_box_tag :condensed, nil, (params[:commit].nil? || params[:condensed].present?), class: 'vmid'
                = label_tag :condensed, 'Hide screennames and icons'
            %tr
              %td.centered{colspan: 2}= submit_tag "Search", class: 'button'
      %td.vtop
        - if @search_results.present?
          %table
            %tbody
              - @search_results.each do |reply|
                - klass = cycle('even'.freeze, 'odd'.freeze)
                %tr
                  %td.vtop{class: klass}
                    .post-info-box
                      - if reply.icon_id && reply.keyword && !params[:condensed]
                        .post-icon
                          = link_to icon_path(reply.icon_id) do
                            = icon_mem_tag reply.url, reply.keyword
                      .post-info-text
                        - if reply.name.present?
                          .post-character= link_to reply.name, character_path(reply.character_id)
                        - unless params[:condensed]
                          .post-screenname= breakable_text(reply.screenname)
                        .post-author= user_mem_link(reply.user_id, reply.username, reply.user_deleted?)
                    .post-edit-box
                      = link_to reply_path(reply, anchor: "reply-#{reply.id}") do
                        = image_tag "icons/link.png".freeze, title: 'Permalink'.freeze, alt: 'Permalink'.freeze
                    %b= link_to reply.post.subject, reply_path(reply, anchor: "reply-#{reply.id}")
                    .post-content
                      - if params[:subj_content].present?
                        = reply.pg_search_highlight.html_safe
                      - else
                        = sanitize_written_content(reply.content)
                    .post-footer
                      .right-align>
                        - if reply.created_at
                          = precede 'Posted '.freeze do
                            %span.post-posted=pretty_time(reply.created_at)
                        - if reply.id.present? && reply.has_edit_audits?
                          = surround ' | Updated '.freeze, ' | '.freeze do
                            %span.post-updated=pretty_time(reply.last_updated)
                          = link_to 'See History'.freeze, path_for(reply, 'history_%s'), class: 'post-history'.freeze

  - if @search_results && @search_results.total_pages > 1
    %tfoot
      %tr
        %th.search-params-header.empty
        %th.search-results-header= render 'posts/paginator', paginated: @search_results, no_per: true
<commit_msg>Preserve icon_id in the form if present so that further filtering can be applied to the search<commit_after>= render 'search/breadcrumbs'

%table.search-collapsible
  %thead
    %tr
      %th.search-params-header
        Search Replies
        - if @search_results
          = '- '+@search_results.total_entries.to_s+' results'
      %th.search-results-header
        - if @search_results
          = render 'posts/paginator', paginated: @search_results, no_per: true
  %tbody
    %tr
      %td.search-box
        = form_tag search_replies_path, :method => :get do
          %table.search-form
            %tr
              %td{style: 'width: 80px;'}= label_tag :board_id, 'Continuity'
              %td
                - if @post
                  %b= @post.board.name
                - else
                  = select_tag :board_id, options_from_collection_for_select(@boards || [], :id, :name, params[:board_id]), {class: 'chosen-select', prompt: '— Choose Continuity —'}
            %tr
              %td= label_tag :author_id, 'Author'
              %td= select_tag :author_id, options_from_collection_for_select(@users || [], :id, :username, params[:author_id]), {class: 'chosen-select', prompt: '— Choose Author —'}
            %tr
              %td= label_tag :template_id, 'Template'
              %td= select_tag :template_id, options_from_collection_for_select(@templates, :id, :name, params[:template_id]), {class: 'chosen-select', prompt: '— Choose Template —'}
            %tr
              %td= label_tag :character_id, 'Character'
              %td= select_tag :character_id, options_from_collection_for_select(@characters || [], :id, :selector_name, params[:character_id]), {prompt: '— Choose Character —'}
            %tr
              %td= label_tag :subj_content, 'Content'
              %td= text_field_tag :subj_content, params[:subj_content], style: 'width: 100%; margin: 5px 0px;'
            %tr
              %td= label_tag :sort, 'Sort'
              %td= select_tag :sort, options_for_select([['Best match', 'rank'], ['Newest first', 'created_new'], ['Oldest first', 'created_old']], params[:sort]), {class: 'chosen-select'}
            - if @post.present?
              %tr
                %td Post
                %td
                  %b= @post.subject
                  = hidden_field_tag :post_id, @post.id
            - if @icon
              %tr
                %td= label_tag :icon_id, 'Icon'
                %td
                  = icon_tag @icon, class: 'preview-icon search-icon-preview'
                  = hidden_field_tag :icon_id, @icon.id
                  %span.search-icon-keyword= @icon.keyword
            %tr
              %td= label_tag :condensed, 'Condensed'
              %td
                = check_box_tag :condensed, nil, (params[:commit].nil? || params[:condensed].present?), class: 'vmid'
                = label_tag :condensed, 'Hide screennames and icons'
            %tr
              %td.centered{colspan: 2}= submit_tag "Search", class: 'button'
      %td.vtop
        - if @search_results.present?
          %table
            %tbody
              - @search_results.each do |reply|
                - klass = cycle('even'.freeze, 'odd'.freeze)
                %tr
                  %td.vtop{class: klass}
                    .post-info-box
                      - if reply.icon_id && reply.keyword && !params[:condensed]
                        .post-icon
                          = link_to icon_path(reply.icon_id) do
                            = icon_mem_tag reply.url, reply.keyword
                      .post-info-text
                        - if reply.name.present?
                          .post-character= link_to reply.name, character_path(reply.character_id)
                        - unless params[:condensed]
                          .post-screenname= breakable_text(reply.screenname)
                        .post-author= user_mem_link(reply.user_id, reply.username, reply.user_deleted?)
                    .post-edit-box
                      = link_to reply_path(reply, anchor: "reply-#{reply.id}") do
                        = image_tag "icons/link.png".freeze, title: 'Permalink'.freeze, alt: 'Permalink'.freeze
                    %b= link_to reply.post.subject, reply_path(reply, anchor: "reply-#{reply.id}")
                    .post-content
                      - if params[:subj_content].present?
                        = reply.pg_search_highlight.html_safe
                      - else
                        = sanitize_written_content(reply.content)
                    .post-footer
                      .right-align>
                        - if reply.created_at
                          = precede 'Posted '.freeze do
                            %span.post-posted=pretty_time(reply.created_at)
                        - if reply.id.present? && reply.has_edit_audits?
                          = surround ' | Updated '.freeze, ' | '.freeze do
                            %span.post-updated=pretty_time(reply.last_updated)
                          = link_to 'See History'.freeze, path_for(reply, 'history_%s'), class: 'post-history'.freeze

  - if @search_results && @search_results.total_pages > 1
    %tfoot
      %tr
        %th.search-params-header.empty
        %th.search-results-header= render 'posts/paginator', paginated: @search_results, no_per: true

{'fraction_non_alphanumeric': 0.11804177298932048, 'fraction_numerical': 0.001701162461015027, 'mean_word_length': 1.6258064516129032, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4413566', 'n_tokens_mistral': 3053, 'n_tokens_neox': 2958, 'n_words': 625}