1<html><head><title>Microsoft Index Server: 查询语言</title>
2<script language="JavaScript">
3TempString = navigator.appVersion
4if (navigator.appName == "Microsoft Internet Explorer"){
5// Check to see if browser is Microsoft
6if (TempString.indexOf ("4.") >= 0){
7// Check to see if it is IE 4
8document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
9}
10else {
11document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
12}
13}
14else if (navigator.appName == "Netscape") {
15// Check to see if browser is Netscape
16document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
17}
18else
19document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
20</script>
21<meta content="Tells how to refine searches by using complex queries" name="DESCRIPTION"/></head>
22<body bgcolor="#FFFFFF" text="#000000">
23<font face="宋体">
24<h1><a name="QueryLanguage">查询语言</a></h1>
25<p>通过在查询表格中键入单词或短语,然后单击按钮执行查询,就可以在 Web 站点中搜索任意的单词或短语(例如,查询表格示例中的“执行查询”按钮)。本节将介绍以下主题:
26</p>
27<ul>
28<li><strong><a href="#Operators">逻辑和相近运算符</a>:</strong>显示如何通过插入逻辑和相近运算符执行更精确的查询。</li>
29<li><strong><a href="#Wildcards">通配符</a>:</strong>帮助您查找包含与所给单词相似的单词的页。</li>
30<li><strong><a href="#FreeTextQueries">自由文本查询</a>:</strong> 说明如何基于短语的意思来表述一个查询,而不是用精确的单词。</li>
31<li><strong><a href="#VectorQueries">矢量空间查询</a>:</strong>解释如何获得与单词和短语列表匹配的查询结果。</li>
32<li><strong><a href="#PropertyValueQueries">属性值查询</a>:</strong>告诉您如何查询文件的属性值。</li>
33<li><strong><a href="#Examples">查询示例</a>:</strong>给出各种查询的示例。</li>
34<li><strong><a href="#PropertyNamesList">属性名列表</a>:</strong>列出和说明可用于查询的属性名。</li>
35</ul>
36<p>搜索产生一个文件列表,这些文件中包含某个单词或短语(不管单词或短语出现在文件中的任何地方)。下面列表给出表述查询的规则:</p>
37<ul>
38<li>连续的单词作为短语对待,它们在匹配文档中必须以相同的顺序出现。</li>
39<li>查询不区分大小写,因此可以用大写或小写键入查询。</li>
40<li>可以搜索任何单词,但不包括在例外列表中列出的单词(对于英语,包括 <em>a</em>、<em>an</em>、<em>and</em>、<em>as</em> 和其他一些单词), 它们在查询中将被忽略。</li>
41<li>在例外列表中的单词在短语中将作为占位符对待,用来进行相似查询。例如,如果查询“Word for Windows”,结果将给出“Word for Windows”和“Word and Windows” ,因为 <em>for </em> 是一个在例外列表中出现的虚词。</li>
42<li>标点符号在搜索时将被忽略,如句号 (.)、冒号 (:)、分号 (;) 和逗号 (,)。</li>
43<li>要在查询中使用特殊对待的字符,如 &、|、^、#、@、$、(、),请用引号 (“) 将查询括起来。</li>
44<li>要搜索包含引号的单词或短语,请先用引号把整个短语括起来,并用两遍引号括住想用引号括起来的单词。例如,“World-Wide Web or ““Web””” 将搜索 <em>World-Wide Web or “Web”</em>。</li>
45<li>可以插入<a href="#Operators">逻辑运算符</a>(<strong>AND</strong>、 <strong>OR</strong> 和 <strong>NOT</strong>)以及<a href="#Operators">相近运算符</a> (<strong>NEAR</strong>) 来指定附加的搜索信息。</li>
46<li><a href="#Wildcards">通配字符</a> (*) 可以用所给前缀匹配单词。查询 esc* 可以匹配词条 “ESC”、“escape” 等等。</li>
47<li><a href="#FreeTextQueries">自由文本查询</a>可以不按查询语法指定查询。</li>
48<li>可以指定<a href="#VectorQueries">矢量空间查询</a>。</li>
49<li>可以执行 ActiveX™ (OLE) 和文件属性的<a href="#PropertyValueQueries">属性值查询</a>。</li>
50</ul>
51<h1><a name="Operators">逻辑和相近运算符</a></h1>
52<p>逻辑和相近运算符可以创建更精确的查询。</p>
53<table border="1" cellpadding="4" cellspacing="1" width="100%">
54<tr>
55<th align="Left" bgcolor="#C0C0C0" valign="bottom" width="33%">搜索目标</th>
56<th align="Left" bgcolor="#C0C0C0" valign="bottom" width="33%">示例</th>
57<th align="Left" bgcolor="#C0C0C0" valign="bottom" width="33%">结果</th>
58</tr>
59<tr>
60<td valign="top">同一页中同时包含两个词条</td>
61<td valign="top"><code>access and basic</code><br/>
62<strong>—</strong>或<strong>—</strong><br/>
63<code>access & basic</code></td>
64<td valign="top">包含单词“access”和“basic”的页。</td>
65</tr>
66<tr>
67<td valign="top">同一页中包含两个词条之一</td>
68<td valign="top"><code>cgi or isapi</code><br/>
69<strong>—</strong>或<strong>—</strong><br/>
70<code>cgi | isapi</code></td>
71<td valign="top">包含单词“cgi”或“isapi”的页。</td>
72</tr>
73<tr>
74<td valign="top">包含第一个词条,但不包含第二个词条</td>
75<td valign="top"><code>access and not basic</code><br/>
76<strong>—</strong>或<strong>—</strong><br/>
77<code>access & ! basic</code></td>
78<td valign="top">包含单词“access”,但不包含单词“basic”的页。</td>
79</tr>
80<tr>
81<td valign="top">不匹配某个属性值的页</td>
82<td valign="top"><code>not @size = 100</code><br/>
83<strong>—</strong>或<strong>—</strong><br/>
84<code>! @size = 100</code></td>
85<td valign="top">大小不是 100 字节的页。</td>
86</tr>
87<tr>
88<td valign="top">同一页中同时包含两个词条,且互相靠近</td>
89<td valign="top"><code>excel near project</code><br/>
90<strong>—</strong>或<strong>—</strong><br/>
91<code>excel ~ project</code></td>
92<td valign="top">包含互相靠近的单词“excel”和“project”的页。</td>
93</tr>
94</table>
95<p>提示:</p>
96<ul>
97<li>可以在查询表达式中加入括弧,表达式中带括弧的部分比查询的其他部分先执行。</li>
98<li>使用双引号 (“) 可以指明逻辑或 <strong>NEAR</strong> 运算符关键字在查询中需要忽略。例如,“Abbott and Costello”将匹配包含该短语的页,而不是匹配符合该逻辑表达式的页。作为运算符,单词 <em>and</em> 在英语中是一个虚词。</li>
99<li><strong>NEAR</strong> 运算符与 <strong>AND</strong> 运算符相似, <strong>NEAR</strong> 也返回一页中两个单词都包含的页。但是,<strong>NEAR</strong> 和 <strong>AND</strong> 运算符不同之处在于,<strong>NEAR</strong> 要看单词是否靠近。也就是说,包含搜索单词较近的页的等级将大于或等于单词相隔较远的页的等级。如果搜索的单词相隔大于 50 个单词,该页将定为等级零</li>
100<li>在内容查询中,<strong>NOT</strong> 运算符只能用在 <strong>AND</strong> 运算符之后,它仅用来排除匹配前面内容约束的页。对于属性值查询,<strong>NOT</strong> 运算符可以不与 <strong>AND</strong> 运算符一起使用。</li>
101<li><strong>AND</strong> 运算符的优先级高于 <strong>OR</strong>。例如,下面的前三个查询相等,但第四个不同:<br/>
102a AND b OR c<br/>
103c OR a AND b<br/>
104c OR (a AND b)<br/>
105(c OR a) AND b</li>
106</ul>
107<p><strong>注意</strong> 在所有语言中,符号(&、|、!、 ~)与英语关键字 <strong>AND</strong>、<strong>OR</strong>、<strong>NOT</strong> 和 <strong>NEAR</strong> 的作用相同(Index Server 支持)。如果浏览器被设置为下列六种语言,本地化的关键字也可以使用。</p>
108<table border="1" cellpadding="4" cellspacing="1" width="100%">
109<tr>
110<th align="Left" bgcolor="#C0C0C0" valign="bottom" width="40%">语言</th>
111<th align="Left" bgcolor="#C0C0C0" valign="bottom" width="60%">关键字</th>
112</tr>
113<tr>
114<td valign="top">德语</td>
115<td valign="top"><strong>UND</strong>、<strong>ODER</strong>、<strong>NICHT</strong>、<strong>NAH</strong></td>
116</tr>
117<tr>
118<td valign="top">法语</td>
119<td valign="top"><strong>ET</strong>、<strong>OU</strong>、<strong>SANS</strong>、 <strong>PRES</strong></td>
120</tr>
121<tr>
122<td valign="top">西班牙语</td>
123<td valign="top"><strong>Y</strong>、<strong>O</strong>、<strong>NO</strong>、<strong>CERCA</strong></td>
124</tr>
125<tr>
126<td valign="top">荷兰语</td>
127<td valign="top"><strong>EN</strong>、<strong>OF</strong>、<strong>NIET</strong>、 <strong>NABIJ</strong></td>
128</tr>
129<tr>
130<td valign="top">瑞典语</td>
131<td valign="top"><strong>OCH</strong>、<strong>ELLER</strong>、<strong>INTE</strong>、<strong>NÄRA</strong></td>
132</tr>
133<tr>
134<td>意大利语</td><td><strong>E</strong>、<strong>O</strong>、<strong>NO</strong>、<strong>VICINO</strong></td>
135</tr>
136</table>
137<p><strong>注意</strong> NEAR 运算符只能用于单词或短语。</p>
138<h1><a name="Wildcards">通配符</a></h1>
139<p><a name="Wildcards">通配符可以帮助您查找包含与所给单词相似的单词的页。</a></p>
140<table border="1" cellpadding="4" cellspacing="1" width="100%">
141<tr>
142<th align="Left" bgcolor="#C0C0C0" valign="bottom" width="33%"><a name="Wildcards">搜索目标</a></th>
143<th align="Left" bgcolor="#C0C0C0" valign="bottom" width="33%"><a name="Wildcards">示例</a></th>
144<th align="Left" bgcolor="#C0C0C0" valign="bottom" width="33%"><a name="Wildcards">结果</a></th></tr>
145<tr>
146<td valign="top"><a name="Wildcards">具有相同前缀的单词</a></td>
147<td valign="top"><a name="Wildcards"><code>comput*</code></a></td>
148<td valign="top"><a name="Wildcards">包含前缀为“comput”的单词的页,例如“computer”、“computing”等等</a>。</td>
149</tr>
150<tr>
151<td valign="top"><a name="Wildcards">基于同一个本词的单词</a></td>
152<td valign="top"><a name="Wildcards"><code>fly**</code></a></td>
153<td valign="top"><a name="Wildcards">包含基于相同本词“fly”的单词的页,例如“flying”、“flown”、“flew”等等</a>。</td>
154</tr>
155</table>
156<h1><a name="FreeTextQueries">自由文本查询</a></h1>
157<p><a name="FreeTextQueries">在自由文本查询中,查询引擎查找与单词或短语最佳匹配的页。这种查询匹配意思,而不是精确的单词。在自由文本查询中,逻辑、相近和通配运算符都将被忽略。自由文本查询以 $contents 为前缀。</a></p>
158<table border="1" cellpadding="4" cellspacing="1" width="100%">
159<tr><th align="Left" bgcolor="#C0C0C0" valign="bottom" width="33%"><a name="FreeTextQueries">搜索目标</a></th>
160<th align="Left" bgcolor="#C0C0C0" valign="bottom" width="33%"><a name="FreeTextQueries">示例</a></th>
161<th align="Left" bgcolor="#C0C0C0" valign="bottom" width="33%"><a name="FreeTextQueries">结果</a></th>
162</tr>
163<tr>
164<td valign="top"><a name="FreeTextQueries">匹配自由文本的文件</a></td>
165<td valign="top"><a name="FreeTextQueries"><code>$contents how do I print in Microsoft Excel? </code></a></td>
166<td valign="top"><a name="FreeTextQueries">提到 printing 和 Microsoft Excel 的页。</a></td>
167</tr>
168</table>
169<h1><a name="VectorQueries">矢量空间查询</a></h1>
170<p>查询引擎支持矢量空间查询。矢量查询返回匹配单词和短语列表的页,每页的排列指明了页面与查询匹配的程度。</p>
171<table border="1" cellpadding="4" cellspacing="1" width="100%">
172<tr>
173<th align="Left" bgcolor="#C0C0C0" valign="bottom" width="33%">搜索目标</th>
174<th align="Left" bgcolor="#C0C0C0" valign="bottom" width="33%">示例</th>
175<th align="Left" bgcolor="#C0C0C0" valign="bottom" width="33%">结果</th></tr>
176<tr>
177<td valign="top">包含指定单词的页</td>
178<td valign="top"><code>light, bulb</code></td>
179<td valign="top">包含与搜索单词最匹配的单词的文件</td>
180</tr>
181<tr>
182<td valign="top">包含加权的前缀、单词和短语的页</td>
183<td valign="top"><code>invent*, light[50], bulb[10],
184"light bulb"[400]</code></td>
185<td valign="top">包含以“invent,”为前缀的单词、单词“light”、 “bulb”和短语“light bulb”的文件(词条被加权)</td>
186</tr>
187</table>
188<p> <!-- </p> \--><br/>
189<ul>
190<li>在矢量查询中的组件以逗号隔开。</li>
191<li>矢量查询中的组件可以用 [weight] 语法加权。</li>
192<li>矢量查询返回的页不必匹配查询的所有词条。</li>
193<li>当结果按等级排序时,矢量查询最好。</li>
194</ul>
195<h1><a name="PropertyValueQueries">属性值查询</a></h1>
196<p>用属性值查询,可以查找含有与所给标准相匹配的属性值的文件。可以用来查询的属性包括文件的基本信息(如文件名、文件大小)和 ActiveX 属性(包含在文档摘要中),ActiveX 属性由 ActiveX 应用程序创建并存储在文件中。</p>
197<p>下面是两种类型的属性查询:</p>
198<ul>
199<li><a name="PropertyValueQueries"><strong>关系属性查询</strong>包括“at”字符 (@)、</a><a href="#PropertyNames">属性名</a>、<a href="#RelationalOperators">关系运算符</a>和<a href="#PropertyValues">属性值</a>。例如,要查找大小超过一兆字节的文件,可以执行查询 @size > 1000000。</li>
200<li><strong>正则表达式查询</strong>包括号码符号 (#)、属性名和属性值的<a href="#RegularExpressions">正则表达式</a>。例如,要查找所有视频 (.avi) 文件,可以执行查询 #filename *.avi。正则表达式不会匹配特定的属性内容 (#contents) 和全部 (#all)。 在查询中不能检索的属性不能用于 # 查询,包括未存储在属性缓存中的 HTML META 属性。</li>
201</ul>
202<p>本节包含以下主题:</p>
203<ul>
204<li><a href="#PropertyNames">属性名</a></li>
205<li><a href="#RelationalOperators">关系运算符</a></li>
206<li><a href="#PropertyValues">属性值</a></li>
207</ul>
208<h2><a name="PropertyNames">属性名</a></h2>
209<p>属性名以“at”(@) 或号码符号 (#) 开头,@ 用于关系查询,# 用于正则表达式查询。</p>
210<p>如果未指定属性名,将假定为 <em>@contents</em>。</p>
211<p>所有文件中都可用的属性包括:</p>
212<table border="1" cellpadding="4" cellspacing="1" width="100%">
213<tr>
214<th align="Left" bgcolor="#C0C0C0" valign="bottom" width="40%">属性名</th>
215<th align="Left" bgcolor="#C0C0C0" valign="bottom" width="60%">说明</th></tr>
216<tr>
217<td valign="top">All</td>
218<td valign="top">匹配单词、短语和任何属性</td>
219</tr>
220<tr>
221<td valign="top">Contents</td>
222<td valign="top">文件中单词和短语</td>
223</tr>
224<tr>
225<td valign="top">Filename</td>
226<td valign="top">文件的名称</td>
227</tr>
228<tr>
229<td valign="top">Size</td>
230<td valign="top">文件大小</td>
231</tr>
232<tr>
233<td valign="top">Write</td>
234<td valign="top">文件的最后一次修改时间</td>
235</tr>
236</table>
237<p>ActiveX 属性值也可以用于查询,绝大多数由 ActiveX 应用程序创建的 Web 站点文件可以用下列属性查询:</p>
238<table border="1" cellpadding="4" cellspacing="1" width="100%">
239<tr>
240<th align="Left" bgcolor="#C0C0C0" valign="bottom" width="40%">属性名</th>
241<th align="Left" bgcolor="#C0C0C0" valign="bottom" width="60%">说明</th></tr>
242<tr>
243<td valign="top">DocTitle</td>
244<td valign="top">文档的标题</td>
245</tr>
246<tr></tr></table></p></font></body></html>
用asp怎样编写文档搜索页面(1)
comments powered by Disqus