<commit_before>%link{:rel => "stylesheet", :href => "/css/events.css"}
%script{:src => "/js/chart.js"}
%script{:src => "https://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/md5.js"}

%div{:class => "row", 'ng-controller' => 'eventsController', :id => 'eventsController'}
  %span{:id => 'corner_status'}
  #search{:class => 'col-md-12 pull-right main-content'}
    %div{:class => "panel"}
    #search_field{:role => "search", :class => "collapse in"}
      %div{:class => "panel-body"} 
        %form{:role => 'search', :class => 'form-inline'}
          .form-group{:class => 'form-group col-md-9', :id => 'search_form_group'}
            %input{:type => 'text', :class => 'form-control', :placeholder => 'Search', 'ng-model' => 'search_field', :id => 'search_input'}
            %small{:class => 'help-block'}
              %a{'data-toggle' => 'modal', 'data-target' => '#howdoisearch'}= "How do I search?"
          .form-group{:class => 'form-group', :class => 'col-md-2'}
            %select{:id => 'sort', 'ng-model' => 'sort_field', :class => 'form-control'}
              %option{:disabled => true}= 'Sort by'
              %option{:value => 'client'}= 'client'
              %option{:value => '-client'}= 'client (decending)'
              %option{:value => 'check'}= 'check'
              %option{:value => '-check'}= 'check (decending)'
              %option{:value => 'status'}= 'status'
              %option{:value => '-status'}= 'status (decending)'
              %option{:value => 'age', :selected => "selected"}= 'age'
              %option{:value => '-age'}= 'age (decending)'
              %option{:value => 'issued'}= 'issued'
              %option{:value => '-issued'}= 'issued (decending)'
              %option{:value => 'output'}= 'output'
              %option{:value => '-output'}= 'output (decending)'
          %input{:type => 'submit', :value => 'Search', :class => 'btn btn-success pull-right', 'ng-click' => 'updateParams()'}
        

  #stats{:class => "col-md-3 pull-left main-content"}
    %div{:class => "panel"}
    #stats_field{:role => "stats", :class => "collapse in"}
      %div{:class => "panel-body", 'ng-hide' => 'events.length == 0 || events_spin'}
        %div{:id => 'stats_status', 'ng-hide' => 'events_spin'}
          #totals
            %span{:class => "label label-warning pointer", 'ng-click' => 'appendQuery(1, "status", false)'}= " - "
            %span{:class => "label label-danger pointer", 'ng-click' => 'appendQuery(2, "status", false)'}= " - "
            %span{:class => "label label-info pointer", 'ng-click' => 'appendQuery(3, "status", false)'}= " - "
        %div{:id => 'stats_by_count', 'ng-repeat' => '(name, stat) in stats'}
          %h5
            {{name | uppercase }} stats
          %table{:class => 'table table-striped', 'ng-hide' => 'events_spin'}
            %tr
              %td
                {{name}} name
              %td="Quantity"
            %tr{'ng-repeat' => 's in stat | slice:0:10'}
              %td{:class => 'col-md-3'}
                %span{:class => 'appendQuery', 'ng-click' => 'appendQuery(s[0], name)'}
                  {{s[0]}}
              %td{:class => 'col-md-1 text-center'}
                {{s[1]}}

  #events{:class => "col-md-9 pull-right main-content", :style => "margin-bottom: 100px"}
    %div{:class => "panel"}
            
    #events_field{:role => "events", :class => "collapse in"}
      %ul{:class => "list-group"}
        %div{:class => 'progress progress-striped active', 'ng-show' => 'events_spin', :style => 'margin-top: 50px;'}
          %div{:class => 'progress-bar progress-bar-success', :role => 'progressbar', 'aria-valuenow' => '100', 'aria-valuemin' => '0', 'aria-valuemax' => '100', :style => 'width: 100%'}
            %span{:class => 'sr-only'}= "getting events..."
        %div{:class => 'text-center', 'ng-hide' => 'events.length || events_spin'}= "No Events"
        %div{:class => 'pull-right', 'ng-hide' => 'events.length == 0 || events_spin'}
          %span{:class => 'view'}= "View"
          %select{:id => 'limit', 'ng-model' => 'limit_field'}
            %option{:value => '10'}= '10'
            %option{:value => '20'}= '20'
            %option{:value => '50', :selected => "selected"}= '50'
            %option{:value => '100'}= '100'
            %option{:value => '200'}= '200'
        %a{:class => 'text-right pull-left', :id => 'events-accordian-toggle', 'ng-click' => 'bulkToggleDetails()', 'ng-hide' => 'events.length == 0 || events_spin'}= "{{bulk}} all details"
        %br
        %li{:class => "list-group-item", 'ng-repeat' => 'event in events'}
          %div{:class => "row"}
            %div{:class => "panel"}
              %div{:class => "panel-heading flat-heading event_line", :panel => "{{event.client.name}}/{{event.check.name}}"}
                %div{:class => "col-md-2"}
                  %h4
                    %span{:class => "label label-{{event.color}} pull-right pointer", 'ng-click' => 'appendQuery(event.check.status, "status", false)'}="{{event.wstatus}}"
                %h5{:class => "event_title pull-left"}
                  %span{'ng-show' => 'event.client.silenced', :class => 'silenceBtn glyphicon glyphicon-volume-off', 'data-toggle' => 'popover', 'data-content' => '{{event.client.silence_html}}'}
                  %span{:class => 'appendQuery', 'ng-click' => 'appendQuery(event.client.name, "client")'}
                    {{event.client.name}}
                  %span=" / "
                  %span{'ng-show' => 'event.check.silenced', :class => 'silenceBtn glyphicon glyphicon-volume-off', 'data-toggle' => 'popover', 'data-content' => '{{event.check.silence_html}}'}
                  %span{:class => 'appendQuery', 'ng-click' => 'appendQuery(event.check.name, "check")'}
                    {{event.check.name}}
                  %small{:class => 'text-muted muted-output'}
                    \- {{event.check.output}}
                %h5
                  %span{:class => 'glyphicon glyphicon-collapse-down toggleBtnIcon pull-right', 'ng-click' => "toggleDetails(event.id)"}
              %div{:class => "panel-body panel-collapse collapse {{event.showdetails}}", :id => "{{event.id}}"}
                %div{:class => 'dropdown actions pull-right'}
                  %button{:class => 'btn btn-link dropdown-toggle', 'data-toggle' => 'dropdown'}
                    Actions
                    %span{:class => "caret"}
                  %ul{:class => 'dropdown-menu'}
                    %li
                      %a{"href" => "#", 'ng-click' => 'resolveEvent(event.client.name, event.check.name)'}= "Resolve"
                    %li{:class => 'divider'}
                    %li{:class => 'dropdown-header'}="Silence"
                    %li
                      %a{"href" => "#", 'ng-click' => 'updateSilencePath(event.client.name)', 'data-toggle' => 'modal', 'data-target' => '#silence_window'}= "Client"
                    %li
                      %a{"href" => "#", 'ng-click' => 'updateSilencePath(event.client.name + "/" + event.check.name)', 'data-toggle' => 'modal', 'data-target' => '#silence_window'}= "Check"
                %div{'ng-bind-html' => 'to_trusted(build_event_attr_html(event))'}
                %br
                %br
                %br
                %div{:class => 'col-md-12 pull-left output'}
                  {{event.check.output}}
  %div{:class => 'modal fade', :id => 'silence_window'}
    %div{:class => 'modal-dialog'}
      %div{:class => 'modal-content'}
        %div{:class => 'modal-header'}
          %button{:type => "button", :class => "close pull-right", 'data-dismiss' => "modal", 'aria-hidden' => "true"}
          %h4{:class => 'modal-title'}= "Silence {{silencePath}}"
        %div{:class => 'modal-body'}
          %form{:class => 'form-horizontal', :role => 'form', :id => 'silence_form'}
            %div{:class => 'form-group silence_author has-feedback'}
              %label{:for => 'author', :class => 'col-sm-2 control-label'}= "Author*"
              %div{:class => 'col-sm-10'}
                %input{:type => 'text', :class => 'form-control', :id => 'author', :placeholder => '<NAME>'}
            %div{:class => 'form-group silence_comment has-feedback'}
              %label{:for => 'comment', :class => 'col-sm-2 control-label'}= "Comment*"
              %div{:class => 'col-sm-10'}
                %textarea{:class => 'form-control', :id => 'comment', :placeholder => 'Enter comments here', :rows => '3'}
            %div{:class => 'form-group'}
              %label{:for => 'expires', :class => 'col-sm-2 control-label'}="Expiration*"
              %div{:class => 'col-sm-10'}
                %div{:class => 'radio'}
                  %label
                    %input{:type => 'radio', :name => 'expiration', :id => 'resolve', :value => 'resolve', :checked => ''}
                    On resolve
                    %span{:class => 'glyphicon glyphicon-question-sign', 'data-toggle' => 'tooltip', 'data-placement' => 'right', :title => '"On resolve" will cause this silence to be deleted once the check clears for check, clients require all checks to clear. A minimum of 1 hour is enforced.'}
                %div{:class => 'radio'}
                  %label
                    %input{:type => 'radio', :name => 'expiration', :id => 'timer', :value => 'timer'}
                    %span{:class => 'pull-left'}="Timer"
                    %div{:class => 'col-sm-3 silence_timer_val has-feedback'}
                      %input{:type => 'text', :name => 'expirationl', :id => 'timer_val', :class => 'input-sm form-control', :placeholder => ''}
                    %span{:class => 'glyphicon glyphicon-question-sign', 'data-toggle' => 'tooltip', 'data-placement' => 'right', :title => '"Timer" will cause this silence to be deleted in a predetermined time span. The expires value should be inputted as a number followed by a single character. m = minutes, h = hours, d = days, w = weeks. (examples 15m, 2h, 1d, 5w)'}
                %div{:class => 'radio'}
                  %label
                    %input{:type => 'radio', :name => 'expiration', :id => 'never', :value => 'never'}
                    Never
                    %span{:class => 'glyphicon glyphicon-question-sign', 'data-toggle' => 'tooltip', 'data-placement' => 'right', :title => '"Never" will cause this silence to, surprise surprise, never expire. It will remain silence until yourself or someone else manually deletes the silence. It is highly discourage to permanently silence anything. Its extremely rare that that is ever the correct action.'}
          %div{:class => 'modal-footer'}
            %button{:type => 'submit', :class => 'btn btn-default pull-right', 'ng-click' => 'saveSilence()'}= "Create"

%div{:class => 'modal fade', :id => 'howdoisearch'}
  %div{:class => 'modal-dialog'}
    %div{:class => 'modal-content'}
      %div{:class => 'modal-header'}
        %button{:type => "button", :class => "close", 'data-dismiss' => "modal", 'aria-hidden' => "true"}
        %h4{:class => 'modal-title'}= "How Do I Search?"
      %div{:class => 'modal-body'}
        %h4="Query Syntax"
        %p
          The Cloudant search query syntax is based on the
          %a{:href => 'http://lucene.apache.org/core/4_2_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package_description'}="Lucene"
          syntax. Search queries take the form of "name:value" (unless the name is omitted, in which case they hit the default field as we demonstrated in the first example, above).
        %p
          Queries over multiple fields can be logically combined and groups and fields can be grouped. The available logical operators are: "AND", "+", "OR", "NOT" and "-", and are case sensitive. Range queries can run over strings or numbers.
        %p
          If you want a fuzzy search you can run a query with "~" to find terms like the search term, for instance "look~" will find terms book and took.
        %p
          You can also increase the importance of a search term by using the boost character "^". This makes matches containing the term more relevant, e.g. cloudant "data layer"^4 will make results containing "data layer" 4 times more relevant. The default boost value is 1. Boost values must be positive, but can be less than 1 (e.g. 0.5 to reduce importance).
        %p
          Wild card searches are supported, for both single ("?") and multiple ("*") character searches. "dat?" would match date and data, "dat*" would match date, data, database, dates etc. Wildcards must come after a search term, you cannot do a query like "*base".

        %p
          The following characters require escaping if you want to search on them

        %p{:class => 'well well-sm'}
          + - && || ! ( ) { } [ ] ^ " ~ * ? : \ /

        %h4="Examples"
        %table{:class => "table table-striped"}
          %tr
            %td="Desired Result"
            %td="Query"
          %tr
            %td="For clients STARTING with 'web'"
            %td="client:web*"
          %tr
            %td="For checks ENDING with 'process'"
            %td="check:process"
          %tr
            %td="For checks MATCHING with 'disk_usage'"
            %td="check:\"disk_usage\""
          %tr
            %td="For statuses warning or critical"
            %td="status:[1 TO 2]"
          %tr
            %td="For 'web' clients and critical"
            %td="client:web* AND status:2"
          %tr
            %td="Search for everything, except checks that start with 'disk'"
            %td="*:* AND NOT check:disk*"
          %tr
            %td="For 'web' or 'dbs' clients and status is unknown"
            %td="client:(web* OR db*) AND status:3"
          %tr
            %td="Full text search for 'failure'"
            %td="failure"
          %tr
            %td="Events since Jan 1, 2014"
            %td="issued:[1388534400 TO Infinity]"
      %div{:class => 'modal-footer'}
        %button{:type => 'button', :class => 'btn btn-default', 'data-dismiss' => 'modal'}= "Close"

%script{:type => "text/javascript", :src => "/js/events.js"}<commit_msg>move search examples to the top<commit_after>%link{:rel => "stylesheet", :href => "/css/events.css"}
%script{:src => "/js/chart.js"}
%script{:src => "https://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/md5.js"}

%div{:class => "row", 'ng-controller' => 'eventsController', :id => 'eventsController'}
  %span{:id => 'corner_status'}
  #search{:class => 'col-md-12 pull-right main-content'}
    %div{:class => "panel"}
    #search_field{:role => "search", :class => "collapse in"}
      %div{:class => "panel-body"} 
        %form{:role => 'search', :class => 'form-inline'}
          .form-group{:class => 'form-group col-md-9', :id => 'search_form_group'}
            %input{:type => 'text', :class => 'form-control', :placeholder => 'Search', 'ng-model' => 'search_field', :id => 'search_input'}
            %small{:class => 'help-block'}
              %a{'data-toggle' => 'modal', 'data-target' => '#howdoisearch'}= "How do I search?"
          .form-group{:class => 'form-group', :class => 'col-md-2'}
            %select{:id => 'sort', 'ng-model' => 'sort_field', :class => 'form-control'}
              %option{:disabled => true}= 'Sort by'
              %option{:value => 'client'}= 'client'
              %option{:value => '-client'}= 'client (decending)'
              %option{:value => 'check'}= 'check'
              %option{:value => '-check'}= 'check (decending)'
              %option{:value => 'status'}= 'status'
              %option{:value => '-status'}= 'status (decending)'
              %option{:value => 'age', :selected => "selected"}= 'age'
              %option{:value => '-age'}= 'age (decending)'
              %option{:value => 'issued'}= 'issued'
              %option{:value => '-issued'}= 'issued (decending)'
              %option{:value => 'output'}= 'output'
              %option{:value => '-output'}= 'output (decending)'
          %input{:type => 'submit', :value => 'Search', :class => 'btn btn-success pull-right', 'ng-click' => 'updateParams()'}
        

  #stats{:class => "col-md-3 pull-left main-content"}
    %div{:class => "panel"}
    #stats_field{:role => "stats", :class => "collapse in"}
      %div{:class => "panel-body", 'ng-hide' => 'events.length == 0 || events_spin'}
        %div{:id => 'stats_status', 'ng-hide' => 'events_spin'}
          #totals
            %span{:class => "label label-warning pointer", 'ng-click' => 'appendQuery(1, "status", false)'}= " - "
            %span{:class => "label label-danger pointer", 'ng-click' => 'appendQuery(2, "status", false)'}= " - "
            %span{:class => "label label-info pointer", 'ng-click' => 'appendQuery(3, "status", false)'}= " - "
        %div{:id => 'stats_by_count', 'ng-repeat' => '(name, stat) in stats'}
          %h5
            {{name | uppercase }} stats
          %table{:class => 'table table-striped', 'ng-hide' => 'events_spin'}
            %tr
              %td
                {{name}} name
              %td="Quantity"
            %tr{'ng-repeat' => 's in stat | slice:0:10'}
              %td{:class => 'col-md-3'}
                %span{:class => 'appendQuery', 'ng-click' => 'appendQuery(s[0], name)'}
                  {{s[0]}}
              %td{:class => 'col-md-1 text-center'}
                {{s[1]}}

  #events{:class => "col-md-9 pull-right main-content", :style => "margin-bottom: 100px"}
    %div{:class => "panel"}
            
    #events_field{:role => "events", :class => "collapse in"}
      %ul{:class => "list-group"}
        %div{:class => 'progress progress-striped active', 'ng-show' => 'events_spin', :style => 'margin-top: 50px;'}
          %div{:class => 'progress-bar progress-bar-success', :role => 'progressbar', 'aria-valuenow' => '100', 'aria-valuemin' => '0', 'aria-valuemax' => '100', :style => 'width: 100%'}
            %span{:class => 'sr-only'}= "getting events..."
        %div{:class => 'text-center', 'ng-hide' => 'events.length || events_spin'}= "No Events"
        %div{:class => 'pull-right', 'ng-hide' => 'events.length == 0 || events_spin'}
          %span{:class => 'view'}= "View"
          %select{:id => 'limit', 'ng-model' => 'limit_field'}
            %option{:value => '10'}= '10'
            %option{:value => '20'}= '20'
            %option{:value => '50', :selected => "selected"}= '50'
            %option{:value => '100'}= '100'
            %option{:value => '200'}= '200'
        %a{:class => 'text-right pull-left', :id => 'events-accordian-toggle', 'ng-click' => 'bulkToggleDetails()', 'ng-hide' => 'events.length == 0 || events_spin'}= "{{bulk}} all details"
        %br
        %li{:class => "list-group-item", 'ng-repeat' => 'event in events'}
          %div{:class => "row"}
            %div{:class => "panel"}
              %div{:class => "panel-heading flat-heading event_line", :panel => "{{event.client.name}}/{{event.check.name}}"}
                %div{:class => "col-md-2"}
                  %h4
                    %span{:class => "label label-{{event.color}} pull-right pointer", 'ng-click' => 'appendQuery(event.check.status, "status", false)'}="{{event.wstatus}}"
                %h5{:class => "event_title pull-left"}
                  %span{'ng-show' => 'event.client.silenced', :class => 'silenceBtn glyphicon glyphicon-volume-off', 'data-toggle' => 'popover', 'data-content' => '{{event.client.silence_html}}'}
                  %span{:class => 'appendQuery', 'ng-click' => 'appendQuery(event.client.name, "client")'}
                    {{event.client.name}}
                  %span=" / "
                  %span{'ng-show' => 'event.check.silenced', :class => 'silenceBtn glyphicon glyphicon-volume-off', 'data-toggle' => 'popover', 'data-content' => '{{event.check.silence_html}}'}
                  %span{:class => 'appendQuery', 'ng-click' => 'appendQuery(event.check.name, "check")'}
                    {{event.check.name}}
                  %small{:class => 'text-muted muted-output'}
                    \- {{event.check.output}}
                %h5
                  %span{:class => 'glyphicon glyphicon-collapse-down toggleBtnIcon pull-right', 'ng-click' => "toggleDetails(event.id)"}
              %div{:class => "panel-body panel-collapse collapse {{event.showdetails}}", :id => "{{event.id}}"}
                %div{:class => 'dropdown actions pull-right'}
                  %button{:class => 'btn btn-link dropdown-toggle', 'data-toggle' => 'dropdown'}
                    Actions
                    %span{:class => "caret"}
                  %ul{:class => 'dropdown-menu'}
                    %li
                      %a{"href" => "#", 'ng-click' => 'resolveEvent(event.client.name, event.check.name)'}= "Resolve"
                    %li{:class => 'divider'}
                    %li{:class => 'dropdown-header'}="Silence"
                    %li
                      %a{"href" => "#", 'ng-click' => 'updateSilencePath(event.client.name)', 'data-toggle' => 'modal', 'data-target' => '#silence_window'}= "Client"
                    %li
                      %a{"href" => "#", 'ng-click' => 'updateSilencePath(event.client.name + "/" + event.check.name)', 'data-toggle' => 'modal', 'data-target' => '#silence_window'}= "Check"
                %div{'ng-bind-html' => 'to_trusted(build_event_attr_html(event))'}
                %br
                %br
                %br
                %div{:class => 'col-md-12 pull-left output'}
                  {{event.check.output}}
  %div{:class => 'modal fade', :id => 'silence_window'}
    %div{:class => 'modal-dialog'}
      %div{:class => 'modal-content'}
        %div{:class => 'modal-header'}
          %button{:type => "button", :class => "close pull-right", 'data-dismiss' => "modal", 'aria-hidden' => "true"}
          %h4{:class => 'modal-title'}= "Silence {{silencePath}}"
        %div{:class => 'modal-body'}
          %form{:class => 'form-horizontal', :role => 'form', :id => 'silence_form'}
            %div{:class => 'form-group silence_author has-feedback'}
              %label{:for => 'author', :class => 'col-sm-2 control-label'}= "Author*"
              %div{:class => 'col-sm-10'}
                %input{:type => 'text', :class => 'form-control', :id => 'author', :placeholder => '<NAME>'}
            %div{:class => 'form-group silence_comment has-feedback'}
              %label{:for => 'comment', :class => 'col-sm-2 control-label'}= "Comment*"
              %div{:class => 'col-sm-10'}
                %textarea{:class => 'form-control', :id => 'comment', :placeholder => 'Enter comments here', :rows => '3'}
            %div{:class => 'form-group'}
              %label{:for => 'expires', :class => 'col-sm-2 control-label'}="Expiration*"
              %div{:class => 'col-sm-10'}
                %div{:class => 'radio'}
                  %label
                    %input{:type => 'radio', :name => 'expiration', :id => 'resolve', :value => 'resolve', :checked => ''}
                    On resolve
                    %span{:class => 'glyphicon glyphicon-question-sign', 'data-toggle' => 'tooltip', 'data-placement' => 'right', :title => '"On resolve" will cause this silence to be deleted once the check clears for check, clients require all checks to clear. A minimum of 1 hour is enforced.'}
                %div{:class => 'radio'}
                  %label
                    %input{:type => 'radio', :name => 'expiration', :id => 'timer', :value => 'timer'}
                    %span{:class => 'pull-left'}="Timer"
                    %div{:class => 'col-sm-3 silence_timer_val has-feedback'}
                      %input{:type => 'text', :name => 'expirationl', :id => 'timer_val', :class => 'input-sm form-control', :placeholder => ''}
                    %span{:class => 'glyphicon glyphicon-question-sign', 'data-toggle' => 'tooltip', 'data-placement' => 'right', :title => '"Timer" will cause this silence to be deleted in a predetermined time span. The expires value should be inputted as a number followed by a single character. m = minutes, h = hours, d = days, w = weeks. (examples 15m, 2h, 1d, 5w)'}
                %div{:class => 'radio'}
                  %label
                    %input{:type => 'radio', :name => 'expiration', :id => 'never', :value => 'never'}
                    Never
                    %span{:class => 'glyphicon glyphicon-question-sign', 'data-toggle' => 'tooltip', 'data-placement' => 'right', :title => '"Never" will cause this silence to, surprise surprise, never expire. It will remain silence until yourself or someone else manually deletes the silence. It is highly discourage to permanently silence anything. Its extremely rare that that is ever the correct action.'}
          %div{:class => 'modal-footer'}
            %button{:type => 'submit', :class => 'btn btn-default pull-right', 'ng-click' => 'saveSilence()'}= "Create"

%div{:class => 'modal fade', :id => 'howdoisearch'}
  %div{:class => 'modal-dialog'}
    %div{:class => 'modal-content'}
      %div{:class => 'modal-header'}
        %button{:type => "button", :class => "close", 'data-dismiss' => "modal", 'aria-hidden' => "true"}
        %h4{:class => 'modal-title'}= "How Do I Search?"
      %div{:class => 'modal-body'}
        %h4="Query Syntax"
        %h4="Examples"
        %table{:class => "table table-striped"}
          %tr
            %td="Desired Result"
            %td="Query"
          %tr
            %td="For clients STARTING with 'web'"
            %td="client:web*"
          %tr
            %td="For checks ENDING with 'process'"
            %td="check:process"
          %tr
            %td="For checks MATCHING with 'disk_usage'"
            %td="check:\"disk_usage\""
          %tr
            %td="For statuses warning or critical"
            %td="status:[1 TO 2]"
          %tr
            %td="For 'web' clients and critical"
            %td="client:web* AND status:2"
          %tr
            %td="Search for everything, except checks that start with 'disk'"
            %td="*:* AND NOT check:disk*"
          %tr
            %td="For 'web' or 'dbs' clients and status is unknown"
            %td="client:(web* OR db*) AND status:3"
          %tr
            %td="Full text search for 'failure'"
            %td="failure"
          %tr
            %td="Events since Jan 1, 2014"
            %td="issued:[1388534400 TO Infinity]"
        %p
          The Cloudant search query syntax is based on the
          %a{:href => 'http://lucene.apache.org/core/4_2_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package_description'}="Lucene"
          syntax. Search queries take the form of "name:value" (unless the name is omitted, in which case they hit the default field).
        %p
          Queries over multiple fields can be logically combined and groups and fields can be grouped. The available logical operators are: "AND", "+", "OR", "NOT" and "-", and are case sensitive. Range queries can run over strings or numbers.
        %p
          If you want a fuzzy search you can run a query with "~" to find terms like the search term, for instance "look~" will find terms book and took.
        %p
          You can also increase the importance of a search term by using the boost character "^". This makes matches containing the term more relevant, e.g. cloudant "data layer"^4 will make results containing "data layer" 4 times more relevant. The default boost value is 1. Boost values must be positive, but can be less than 1 (e.g. 0.5 to reduce importance).
        %p
          Wild card searches are supported, for both single ("?") and multiple ("*") character searches. "dat?" would match date and data, "dat*" would match date, data, database, dates etc. Wildcards must come after a search term, you cannot do a query like "*base".

        %p
          The following characters require escaping if you want to search on them

        %p{:class => 'well well-sm'}
          + - && || ! ( ) { } [ ] ^ " ~ * ? : \ /

      %div{:class => 'modal-footer'}
        %button{:type => 'button', :class => 'btn btn-default', 'data-dismiss' => 'modal'}= "Close"

%script{:type => "text/javascript", :src => "/js/events.js"}
{'fraction_non_alphanumeric': 0.19098415848601907, 'fraction_numerical': 0.008434631605060779, 'mean_word_length': 2.3283793347487616, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 491, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2187409', 'n_tokens_mistral': 8805, 'n_tokens_neox': 8442, 'n_words': 2160}