templates/query: Fix repeated terms in freq info
[xapian.git] / xapian-applications / omega / templates / query
blob118e1d7fe892592cb638906c47a70a02877b5e16
1 $httpheader{Content-Type,text/html; charset=utf-8}<!DOCTYPE html><html lang="en">
2 $set{flag_spelling,$ne{$cgi{SPELL},0}}
3 $set{thousand,$.}$set{decimal,.}
4 $setmap{prefix,,$split{ S B F},title,S,author,A,topic,B}
5 ${
6 $def{PREV,
7 $if{$ne{$topdoc,0},<input type=image name="&lt;" alt="&lt;"
8 src="/icons/omega/prev.png" height=30 width=30>,
9 <img alt="" src="/icons/omega/prevoff.png" height=30 width=30>}
12 $def{NEXT,
13 $if{$ne{$last,$msize},<input type=image name="&gt;" alt="&gt;"
14 src="/icons/omega/next.png" height=30 width=30>,
15 <img alt="" src="/icons/omega/nextoff.png" height=30 width=30>}
18 $def{P,<input type=image name="$1" value="$1" src="/icons/omega/page-$2.png" $opt{a} alt="$1">}
19 $def{PAGE,$if{$gt{$1,9},$if{$gt{$1,99},$P{$1,$div{$1,100}}}$P{$1,$mod{$div{$1,10},10}}}$P{$1,$mod{$1,10}}}
21 $def{S,<img src="/icons/omega/page-$2s.png" $opt{a} alt=$1>}
22 $def{SPAGE,$if{$gt{$1,9},$if{$gt{$1,99},$S{$1,$div{$1,100}}}$S{$1,$mod{$div{$1,10},10}}}$S{$1,$mod{$1,10}}}
25 $def{PREV,$if{$ne{$topdoc,0},<input type=submit name="&lt;" value="Previous">}}
27 $def{PAGE,<input type=submit name="[" value="$1">}
29 $def{SPAGE,<input type=submit name="[" value="$1" disabled=disabled>}
31 $def{NEXT,$if{$ne{$last,$msize},<input type=submit name="&gt;" value="Next">}}
33 <head>
34 <title>$if{$query,Omega Search: $html{$query},Omega Search}</title>
35 $if{$opt{topterms},$include{inc/toptermsjs}}
36 <style>
37 input[type=image] {
38   border: 0px;
39   }
40 </style>
41 <script type="text/javascript"><!--
42 function f2(n) {return (n>9?"":"0")+n;}
43 function write_date(time_t) {
44 var d=new Date();d.setTime(time_t*1000);
45 var D=d.getFullYear()+"-"+f2(d.getMonth()+1)+"-"+f2(d.getDate());
46 var T=f2(d.getHours())+":"+f2(d.getMinutes())+":"+f2(d.getSeconds());
47 document.write("<span title=\""+D+" "+T+"\">Modified:<br><b>"+D+"</b></span>");
49 // -->
50 </script>
51 </head>
52 <body bgcolor="#ffffff">
53 <form name=P method=get
54 action="$html{$or{$env{SCRIPT_NAME},omega}}" target="_top">
55 <center>
56 <input id="omega-autofocus" type=search name=P value="$html{$query}" size=65 autofocus>
57 <script>
58 if (!("autofocus" in document.createElement("input")))
59  document.getElementById("omega-autofocus").focus();
60 </script>
61 <input type=submit value="Search">
62 <hr>
63 $if{,$include{inc/anyalldropbox},$include{inc/anyallradio}}
64 $if{$opt{topterms},
65  <div title="Suggested terms to add to your query"
66  style="text-align:left;background:#cfc;border:1px solid green;padding:2px;font:11px verdana$. arial$. helvetica$. sans-serif;">
67  $map{$topterms,<span style="white-space:nowrap"><input type=checkbox name=X value="$html{$prettyterm{$_}}" onClick="C(this)">$html{$prettyterm{$_}}</span> }
68  <br><noscript><input type=hidden name=ADD value=1></noscript>
69  </div>
71 <br>
72 $if{$suggestion,Did you mean: <a href="$html{$or{$env{SCRIPT_NAME},omega}?DB=$url{$dbname}&P=$url{$suggestion}$if{$ne{$hitsperpage,10},&HITSPERPAGE=$hitsperpage}$if{$fmt,&FMT=$url{$fmt}}$if{$cgi{COLLAPSE},&COLLAPSE=$url{$cgi{COLLAPSE}}}$map{$relevants,&R=$_}$if{$cgi{THRESHOLD},&THRESHOLD=$url{$cgi{THRESHOLD}}}$map{$cgilist{B},&B=$url{$_}}&SPELL=0}">$html{$suggestion}</a><br>}
73 $or{$html{$error},
74 $if{$eq{$msize,0},
75 $if{$query,No documents match your query,
76 <hr>Searching $nice{$dbsize} documents
78 $if{$not{$msizeexact},
79  $nice{$add{$topdoc,1}}-$nice{$last} of about $nice{$msize} matches,
80  $if{$and{$eq{$last,$msize},$eq{$topdoc,0}},
81   All $nice{$msize} matches,
82   $nice{$add{$topdoc,1}}$if{$ne{$add{$topdoc,1},$last},-$nice{$last}} of exactly $nice{$msize} matches}
84 <hr>
85 </center>
86 $if{$map{$queryterms,$set{U,$unstem{$_}}$set{F_$opt{U},$add{$opt{F_$opt{U}},$freq{$_}}}},$list{$unique{$map{$queryterms,$set{U,$unstem{$_}}$list{$html{$unique{$opt{U}}},<b>,</b>/<b>,</b>}:&nbsp;$nice{$opt{F_$opt{U}}}}},Term frequencies: ,$. ,}}
87 <br><small>Search took $time seconds</small>
88 <table>
89 $if{$opt{clicklog},$set{queryid,$hash{md5,$transform{s/^\s+|\s+$$//g,\1,$query}}}}
90 $if{$opt{clicklog},$log{search.log,$opt{queryid}$.$csv{$query,1}$.$csv{$hitlist{$id$if{$ne{$hit,$sub{$last,1}},$.}},1}$.$topdoc}}
91 $hitlist{<tr><td valign=top>
92 $set{clickurl,$if{$opt{clicklog},$or{$env{SCRIPT_NAME},omega.cgi}?FMT=clicklog&DB=$url{$dbname}&QUERYID=$opt{queryid}&DOCID=$url{$id}&URL=$url{$field{url}},$field{url}}}
93 ${<img src="/icons/omega/score-$div{$percentage,10}.png" alt="$percentage%" height=16 width=32>}
94 <div title="$percentage%" style='float:left;width:60px;height:10px;border:1px solid black;margin-top:4px;'>
95 <div style='width:$div{$mul{$percentage,6},10}px; height:10px; background-color: red;'>
96 </div></div>
97 <div style='float:left;margin-top:2px;font-size:x-small;'>
98 $if{$and{$field{modtime},$ne{$field{modtime},-1}},
99 <script type="text/javascript">write_date($add{$field{modtime}});</script>
100 <noscript>
101 <span title="$html{$date{$field{modtime},%Y-%m-%d %H:%M:%S}}">
102 Modified:<br><b>$html{$date{$field{modtime},%Y-%m-%d}}</b></span>
103 </noscript><br>
105 $if{$field{language},Language: <b>$html{$field{language}}</b><br>}
106 $if{$field{size},<span title="$html{$field{size}} bytes">Size: <b>$html{$filesize{$field{size}}}</b></span><br>}
107 <div title="Mark this document as relevant" style="float:left;background-color:#cfc;border:1px solid green;margin-top:2px;">
108 <input type=checkbox name=R value=$id$if{$relevant, checked}>
109 </div>
110 </div>
111 </td>
112 <td><b><a href="$html{$opt{clickurl}}">$html{$or{$field{caption},$field{title},$prettyurl{$field{url}},Untitled}}</a></b><br>
113 <small>$snippet{$field{sample}}</small><br>
114 <a href="$html{$opt{clickurl}}">$html{$prettyurl{$field{url}}}</a><br>
115 <small>
116 matching:
117 <i>$list{$map{$terms,$html{$prettyterm{$_}}},</i>$. <i>,</i> and <i>}</i></small>${for lynx:}<p></td></tr>}
118 </table>
120 <br><center>
122 ${suppress next, prev, and page links if there's only one page}
123 $if{$ne{$lastpage,1},
124 $set{a,$if{$opt{pagelink_height}, HEIGHT=$opt{pagelink_height}}$if{$opt{pagelink_width}, WIDTH=$opt{pagelink_width}}}
126 ${1-W ... X-(this)-Y ...}
127 $set{w,$min{3,$add{$thispage,-1}}}
128 $set{x,$max{$add{$opt{w},1},$add{$thispage,-3}}}
129 $set{y,$min{$lastpage,$add{$thispage,8}}}
130 $PREV
131 $map{$range{1,$opt{w}},$PAGE{$_}}
132 $if{$ne{$add{$opt{w},1},$opt{x}},...}
133 $map{$range{$opt{x},$add{$thispage,-1}},$PAGE{$_}}
134 $SPAGE{$thispage}
135 $map{$range{$add{$thispage,1},$opt{y}},$PAGE{$_}}
136 $if{$ne{$opt{y},$lastpage},...}
137 $NEXT
140 </center><br>
141 $if{$dbname,<input type=hidden name=DB value="$html{$dbname}">}
142 $if{$ne{$topdoc,0},<input type=hidden name=TOPDOC value=$topdoc>}
143 $if{$ne{$hitsperpage,10},<input type=hidden name=HITSPERPAGE value=$hitsperpage>}
144 $if{$fmt,<input type=hidden name=FMT value="$html{$fmt}">}
145 $if{$cgi{COLLAPSE},<input type=hidden name=COLLAPSE value="$html{$cgi{COLLAPSE}}">}
146 $if{$queryterms,<input type=hidden name=xP value="$html{$queryterms}">}
147 <input type=hidden name=xDB value="$html{$dbname}">
148 <input type=hidden name=xFILTERS value="$html{$filters}">
149 $list{$relevants,<input type=hidden name=R value=",.,">}
150 $if{$cgi{THRESHOLD},<input type=hidden name=THRESHOLD value="$html{$cgi{THRESHOLD}}">}
151 ${Preserve any B filters used - this needs modifying if you modify this template
152   to have B on radio buttons, SELECT, etc}
153 $map{$cgilist{B},<input type=hidden name=B value="$html{$_}">}
154 </form>
155 <hr><div align=right><i><small><a href="https://xapian.org/">$html{$version}</a></small></i></div>
156 </body>
157 </html>
158 $log{query.log}