280 lines
15 KiB
HTML
280 lines
15 KiB
HTML
{{ define "title" }}{{ with .QueryLabel }}{{ . }} - {{ end }}Search - Snowden Archive{{ end }}
|
|
{{ define "search-result-item" }}
|
|
{{ $r := .Result }}{{ $d := $r.Doc }}
|
|
{{ $qs := "" }}{{ if eq $d.Collection "foia" }}{{ $qs = .FOIAQS }}{{ end }}
|
|
<li class="doc-card search-result">
|
|
{{ if .ShowThumbs }}
|
|
<a href="/doc/{{ $d.ID }}" class="result-thumb" tabindex="-1" aria-hidden="true"{{ if and .CardPagePreview $d.Images }} data-pp-id="{{ $d.ID }}" data-pp-imgs="{{ range $i, $im := $d.Images }}{{ if $i }} {{ end }}{{ pathEscape $im }}{{ end }}"{{ end }}>
|
|
{{ if $d.HasThumb }}
|
|
<img src="/files/{{ $d.ID }}/thumb.jpg"{{ if $d.HasGifThumb }} data-gif="/files/{{ $d.ID }}/thumb.gif"{{ end }}
|
|
class="doc-img" alt="" loading="lazy">
|
|
{{ end }}
|
|
</a>
|
|
{{ end }}
|
|
<div class="result-body">
|
|
<h3 class="result-title">
|
|
<a href="/doc/{{ $d.ID }}" class="result-title-link">{{ $r.Title }}</a>
|
|
<a href="/files/{{ $d.ID }}/{{ pathEscape $d.PDFFile }}" target="_blank" rel="noopener" class="doc-pdf">[pdf]</a>
|
|
</h3>
|
|
<span class="doc-type">{{ template "type-badge" $d.Type }}</span>
|
|
|
|
{{ if $d.Publication }}
|
|
{{/* A year links to its publication-year page only when that page
|
|
lists the document: the year of its FIRST publication. */}}
|
|
<div class="result-pubs">
|
|
{{- $shown := false -}}
|
|
{{- range $pub := $d.Publication -}}
|
|
{{- if $pub.Publisher -}}
|
|
{{- if $shown }} · {{ end }}{{ $shown = true -}}
|
|
{{ template "pub-publisher" (dict "Pub" $pub "QS" $qs) }}
|
|
{{- if ge (len $pub.DatePublished) 4 }}{{ $y := slice $pub.DatePublished 0 4 }} {{ if eq $y $d.FirstPubYear }}<a href="/browse/published/{{ $y }}{{ $qs }}" class="meta-link-softer">{{ $y }}</a>{{ else }}<span class="meta-link-softer">{{ $y }}</span>{{ end }}{{ end -}}
|
|
{{- range $j, $r := $pub.Journalists }}{{ if $j }}, {{ else }} - {{ end }}<a href="/browse/journalist/{{ pathEscape $r }}{{ $qs }}">{{ $r }}</a>{{ end -}}
|
|
{{- end -}}
|
|
{{- end }}
|
|
</div>
|
|
{{ end }}
|
|
|
|
<div class="result-meta">
|
|
{{ if $d.DocMeta.Creator }}
|
|
<a href="/browse/agency/{{ pathEscape $d.DocMeta.Creator }}{{ $qs }}" class="meta-link-soft">{{ $d.DocMeta.Creator }}</a>
|
|
{{ end }}
|
|
{{ if and $d.DocMeta.Creator $d.DocMeta.DateCreated }}
|
|
<span class="doc-dot">·</span>
|
|
{{ end }}
|
|
{{ if $d.DocMeta.DateCreated }}
|
|
{{ if ge (len $d.DocMeta.DateCreated) 4 }}
|
|
<a href="/browse/docdate/{{ slice $d.DocMeta.DateCreated 0 4 }}{{ $qs }}" class="meta-link-softer">{{ $d.DocMeta.DateCreated }}</a>
|
|
{{ else }}
|
|
<span class="meta-link-softer">{{ $d.DocMeta.DateCreated }}</span>
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ if $d.DocMeta.Programs }}
|
|
<span class="doc-dot">·</span>
|
|
{{ $progs := $d.DocMeta.Programs }}
|
|
{{ $shown := $progs }}{{ if gt (len $progs) 8 }}{{ $shown = slice $progs 0 8 }}{{ end }}
|
|
{{ facetLinks (dict "Vals" $shown "Cat" "program" "Sep" "dot" "Class" "meta-link-soft" "QS" $qs) }}
|
|
{{ if gt (len $progs) 8 }}<span class="faint">+{{ add (len $progs) -8 }} more</span>{{ end }}
|
|
{{ end }}
|
|
</div>
|
|
|
|
<div class="result-desc">{{ $r.Desc }}</div>
|
|
|
|
{{ range $r.Snippets }}
|
|
<div class="search-result-snippet">{{ . }}</div>
|
|
{{ end }}
|
|
{{ range $r.VersionSnippets }}
|
|
<div class="search-result-snippet version-snippet"><a href="/doc/{{ $d.ID }}/versions/{{ .Slug }}" class="snippet-source">Copy: {{ .Label }}</a> {{ .HTML }}</div>
|
|
{{ end }}
|
|
{{ with $r.MatchesIn }}
|
|
<div class="result-matches-in muted">Matches in:
|
|
{{- range $i, $v := . }}{{ if $i }},{{ end }} <a href="/doc/{{ $d.ID }}/versions/{{ $v.Slug }}">{{ $v.Label }}</a>{{ end }}
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
</li>
|
|
{{ end }}
|
|
|
|
{{ define "content" }}
|
|
<h1 class="search-title">Search</h1>
|
|
|
|
<details class="search-ops-hint">
|
|
<summary>Search syntax help</summary>
|
|
<p>
|
|
Ways to write a value, in any row or after any operator:
|
|
<ul>
|
|
<li><code>cable tapping</code> finds both words anywhere, in their other forms too (<em>tapping</em> also finds <em>tapped</em>);</li>
|
|
<li><code>"apping"</code> finds that text anywhere, even inside a word, like <code>grep -i</code> (it finds for example <em>mapping</em> and <em>tapping</em>);</li>
|
|
<li><code>=tap</code> or <code>="cable tapping"</code> finds exactly those whole words, so <code>=tap</code> skips <em>taps</em> and <em>strap</em>, and on a metadata field it matches one whole value, so <code>agency:=NSA</code> finds documents whose agency is NSA but not <em>NSA, GCHQ</em>;</li>
|
|
<li><code>*</code> wildcard finds part of a word: <code>tap*</code> finds words starting with <em>tap</em>, <code>*land</code> words ending in <em>land</em> and <code>*keys*</code> words containing <em>keys</em>. A leading <code>*</code> needs at least three letters after it.</li>
|
|
<li><code>"upstream collection"~10</code> finds the words within 10 words of each other (in any order, common stopwords ignored).</li>
|
|
<li>A leading <code>-</code> excludes within its row: <code>xkeyscore -tempora</code> finds <em>xkeyscore</em> without <em>tempora</em>, and the row keeps that meaning under OR and NOT.</li>
|
|
</ul>
|
|
</p>
|
|
<p>
|
|
The simple search box (on home page, on 404 page, and via URL <code>?q=</code>) understands field operators:
|
|
<ul>
|
|
<li><code>program:XKEYSCORE country:Germany cable</code> or <code>journalist:="Poitras, Laura"</code>.</li>
|
|
<li>A leading <code>-</code> negates (<code>-tag:=junk</code>, <code>-draft</code>);</li>
|
|
<li><code>date:2013</code>, <code>date:2013..2015</code>, and <code>published:2014-06</code> filter by date.</li>
|
|
<li>Operators: text, title, content, description, agency, journalist, publisher, classification, program, dissemination, banner, genre, series, country, people, tag, type.</li>
|
|
<li>Bare words search all fields.</li>
|
|
</ul>
|
|
</p>
|
|
</details>
|
|
|
|
<form method="GET" action="/search" class="search-form search-panel">
|
|
<input type="hidden" name="do_search" value="1">
|
|
<button type="submit" name="action" value="search" aria-hidden="true" tabindex="-1" class="sr-only">Search</button>
|
|
|
|
<div class="query-rows">
|
|
{{ range $i, $val := .Queries }}
|
|
<div class="query-row">
|
|
<div class="qr-conj">
|
|
{{ if eq $i 0 }}
|
|
<span class="faint">Find</span>
|
|
<input type="hidden" name="fqc" value="and">
|
|
{{ else }}
|
|
<select name="fqc" aria-label="How row {{ add $i 1 }} combines with the rows above">
|
|
<option value="and" {{ if eq (index $.Conjs $i) "and" }}selected{{ end }}>and</option>
|
|
<option value="or" {{ if eq (index $.Conjs $i) "or" }}selected{{ end }}>or</option>
|
|
<option value="not" {{ if eq (index $.Conjs $i) "not" }}selected{{ end }}>and not</option>
|
|
</select>
|
|
{{ end }}
|
|
</div>
|
|
<input type="text" name="fqv" value="{{ $val }}" class="qr-term" aria-label="Search terms, row {{ add $i 1 }}"
|
|
placeholder='word, "text", =exact or *part*'>
|
|
<div class="qr-field">
|
|
<span class="faint qr-in">in</span>
|
|
{{ $fi := index $.Fields $i }}
|
|
<select name="fqf" aria-label="Field to search, row {{ add $i 1 }}">
|
|
{{ range $.FieldOptions }}
|
|
<option value="{{ .Code }}" {{ if eq $fi .Code }}selected{{ end }}>{{ .Label }}</option>
|
|
{{ end }}
|
|
</select>
|
|
</div>
|
|
{{ if ne $i 0 }}
|
|
<button type="submit" name="action" value="remove-{{ $i }}"
|
|
class="remove-row-btn" title="Remove this row">×</button>
|
|
{{ else }}
|
|
<span class="remove-row-spacer"></span>
|
|
{{ end }}
|
|
</div>
|
|
{{ end }}
|
|
|
|
<div class="query-row query-row-add">
|
|
<div class="qr-conj"></div>
|
|
{{ if lt (len .Queries) .ClauseLimit }}
|
|
<button type="submit" name="action" value="add" class="add-row-btn">+ Add row</button>
|
|
{{ else }}
|
|
<span class="faint">{{ .ClauseLimit }} rows is the most a search can have</span>
|
|
{{ end }}
|
|
</div>
|
|
</div>
|
|
|
|
{{ $hasDates := or .DateDocStart .DateDocEnd .DatePubStart .DatePubEnd }}
|
|
{{ $hasFilters := or $hasDates .CollFiltered }}
|
|
<details class="date-filters"{{ if $hasFilters }} open{{ end }}>
|
|
<summary>Filters{{ if $hasFilters }} <span class="faint">(active)</span>{{ end }}</summary>
|
|
<div class="coll-filter-row">
|
|
<span class="faint df-label">Collections</span>
|
|
<label class="coll-check"><input type="checkbox" name="coll" value="news"{{ if index .SelColl "news" }} checked{{ end }}> Reported</label>
|
|
<label class="coll-check"><input type="checkbox" name="coll" value="sidtoday-archive"{{ if index .SelColl "sidtoday-archive" }} checked{{ end }}> SIDtoday archive</label>
|
|
<label class="coll-check"><input type="checkbox" name="coll" value="foia"{{ if index .SelColl "foia" }} checked{{ end }}> FOIA</label>
|
|
</div>
|
|
<div class="date-filter-rows">
|
|
<div class="date-filter-row">
|
|
<span class="faint df-label">Doc date</span>
|
|
<input type="text" name="date_doc_start" value="{{ .DateDocStart }}" aria-label="Document date from" placeholder="yyyy-mm-dd">
|
|
<span class="faint">to</span>
|
|
<input type="text" name="date_doc_end" value="{{ .DateDocEnd }}" aria-label="Document date to" placeholder="yyyy-mm-dd">
|
|
</div>
|
|
<div class="date-filter-row">
|
|
<span class="faint df-label">Published</span>
|
|
<input type="text" name="date_pub_start" value="{{ .DatePubStart }}" aria-label="Published from" placeholder="yyyy-mm-dd">
|
|
<span class="faint">to</span>
|
|
<input type="text" name="date_pub_end" value="{{ .DatePubEnd }}" aria-label="Published to" placeholder="yyyy-mm-dd">
|
|
</div>
|
|
</div>
|
|
</details>
|
|
|
|
<div class="search-actions">
|
|
<button type="submit" name="action" value="search" class="search-btn">Search</button>
|
|
<a href="/search" class="faint reset-link">Reset</a>
|
|
</div>
|
|
</form>
|
|
|
|
{{ if .RecentSearches }}
|
|
<details class="recent-searches">
|
|
<summary>Recent searches <span class="faint">({{ len .RecentSearches }})</span></summary>
|
|
<div class="recent-list">
|
|
{{ range .RecentSearches }}<a class="pill" href="{{ .URL }}">{{ .Label }}</a>{{ end }}
|
|
<form method="POST" action="/history/clear" class="inline-form">
|
|
<input type="hidden" name="which" value="searches">
|
|
<input type="hidden" name="back" value="/search">
|
|
<button type="submit" class="link-btn faint">clear</button>
|
|
</form>
|
|
</div>
|
|
</details>
|
|
{{ end }}
|
|
|
|
<hr class="hr-soft">
|
|
|
|
{{ if .OverClauses }}
|
|
<p class="muted"><strong>Search not run:</strong> it has {{ .OverClauses }} parts - rows, or the
|
|
<code>field:</code>, “quoted” and <code>-excluded</code> terms of a typed query -
|
|
and a search can have at most {{ .ClauseLimit }}. The form above keeps the first {{ .ClauseLimit }};
|
|
the rest, including any exclusions at the end, were left out. Check the rows and search again.</p>
|
|
{{ else if .OverWords }}
|
|
<p class="muted"><strong>Search not run:</strong> it has {{ .OverWords }} words, counting the words of
|
|
“quoted” phrases and <code>-excluded</code> terms, and a search can have at most
|
|
{{ .WordLimit }}. Shorten it and search again.</p>
|
|
{{ end }}
|
|
|
|
{{ if .Searched }}
|
|
{{ if gt (len .SearchTypeCounts) 1 }}{{ template "type-filter" (dict "Action" "/search" "Params" .FormParams "AllTypes" .SearchTypeCounts "SelectedTypes" .SelTypeSet) }}{{ end }}
|
|
<div class="results-bar">
|
|
<h2 class="results-heading">{{ .Total }} result{{ if ne .Total 1 }}s{{ end }}</h2>
|
|
{{ template "sort-bar" (dict "SortURL" .SearchBaseURL "SortBy" .Sort "Order" .Order "ShowRelevance" true "DefaultSort" "relevance") }}
|
|
{{ if .Savable }}
|
|
<form method="POST" action="/pinsearch" class="inline-form">
|
|
<input type="hidden" name="qs" value="{{ .CanonicalQS }}">
|
|
<input type="hidden" name="back" value="{{ .SearchBaseURL }}">
|
|
<button type="submit" class="export-link pin-search-btn" title="{{ if .SearchPinned }}Remove this search from your pinned list{{ else }}Pin this search to your pinned list{{ end }}">{{ if .SearchPinned }}★ unpin search{{ else }}☆ pin search{{ end }}</button>
|
|
</form>
|
|
{{ end }}
|
|
</div>
|
|
|
|
{{ if gt (len .DateHist) 1 }}
|
|
<div class="date-hist" aria-label="Matches per document year">
|
|
{{ range .DateHist }}
|
|
{{ if .URL }}
|
|
<a class="hist-col" href="{{ .URL }}" title="{{ .Count }} matches dated {{ .Year }}">
|
|
<span class="hist-count">{{ .Count }}</span>
|
|
<span class="hist-track"><span class="hist-bar" style="height: {{ .Pct }}%"></span></span>
|
|
<span class="hist-year">{{ .Year }}</span>
|
|
</a>
|
|
{{ else }}
|
|
<span class="hist-col hist-col-undated" title="{{ .Count }} matches with no document date">
|
|
<span class="hist-count">{{ .Count }}</span>
|
|
<span class="hist-track"><span class="hist-bar" style="height: {{ .Pct }}%"></span></span>
|
|
<span class="hist-year">{{ .Year }}</span>
|
|
</span>
|
|
{{ end }}
|
|
{{ end }}
|
|
</div>
|
|
{{ end }}
|
|
|
|
{{ if .Results }}
|
|
{{ if .Facets }}
|
|
<details class="search-facets">
|
|
<summary>Refine results</summary>
|
|
<div class="facets-body">
|
|
{{ range .Facets }}
|
|
<div class="facet-group">
|
|
<span class="facet-label">{{ .Label }}</span>
|
|
<span class="facet-values">{{ range .Values }}<a class="facet-link" href="{{ .URL }}">{{ .Name }}<span class="facet-count">{{ .Count }}</span></a>{{ end }}</span>
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
</details>
|
|
{{ end }}
|
|
<ul class="search-results{{ if .ShowThumbs }} has-thumbs{{ end }}">
|
|
{{ $showThumbs := .ShowThumbs }}
|
|
{{ range .Results }}{{ template "search-result-item" (dict "Result" . "ShowThumbs" $showThumbs "CardPagePreview" $.CardPagePreview "FOIAQS" $.FOIAQS) }}{{ end }}
|
|
</ul>
|
|
{{ if .SnippetsCapped }}
|
|
<p class="muted">Text snippets are shown for the first {{ .SnippetLimit }} results on this page -
|
|
choose a page size in <a href="/preferences">preferences</a>, or narrow the search, to see
|
|
snippets for the rest.</p>
|
|
{{ end }}
|
|
{{ template "pagination" (dict "Page" .Page "TotalPages" .TotalPages "BaseURL" .SearchBaseURL "Sort" .Sort "Order" .Order) }}
|
|
{{ else }}
|
|
<p class="muted">No matches found.</p>
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
{{ template "base.html" . }}
|