Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

185 lines
7.3 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  4. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  5. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  6. // PARTICULAR PURPOSE.
  7. //
  8. // Copyright (c) 1999 Microsoft Corporation. All Rights Reserved.
  9. //
  10. // Sample Name: SQuery (VBSQuery, JSQuery, QSample)
  11. // - Sample Indexing Service scripts
  12. //
  13. //--------------------------------------------------------------------------
  14. Description
  15. ===========
  16. The SQuery sample consists of three scripts that execute using Windows
  17. Script Host. VBSQuery is written in VBScript and performs a simple
  18. query. JSQuery is a translation of VBSQuery to JScript. QSample is
  19. written in VBScript and functions similarly to the C++ sample application
  20. Simple (QSample) with managing and querying functionality.
  21. Path
  22. ====
  23. Source: mssdk\samples\winbase\indexing\SQuery\
  24. User's Guide
  25. ============
  26. * To execute queries using the VBSQuery.vbs or JSQuery.js scripts
  27. 1. Open a command window and change the directory to the path of the
  28. sample scripts.
  29. 2. Submit a fixed query by entering, at the command-line prompt,
  30. cscript vbsquery.vbs
  31. or
  32. cscript jsquery.js
  33. * To execute queries using the QSample.vbs script
  34. 1. Open a command window and change the directory to the path of the
  35. sample scripts.
  36. 2. Formulate a query that you know will succeed. You need to know
  37. the query text and, optionally, values for the machine, catalog,
  38. scope, columns, query language dialect, locale,sort order, and
  39. other argument (see list below).
  40. 3. Submit a query by entering, at the command-line prompt,
  41. cscript qsample.vbs <query> [arguments]
  42. where
  43. <query> is an Indexing Service query.
  44. and the arguments can optionally include:
  45. /c:<catalog> is the name of the catalog.
  46. Default is SYSTEM.
  47. /e:<locale> is ISO locale identifier, e.g. EN-US.
  48. Default is system locale.
  49. /f:(+|-) + or - specifies forcing use of the index.
  50. Default is +.
  51. /g specifies forcing a master merge.
  52. /i:<inputfile> specifies an input file to read with queries,
  53. one per line.
  54. /j specifies to return just files in the scope path,
  55. and not subdirectories.
  56. /l:<dialect> specifies the query language dialect, 1 or 2.
  57. Default is 1.
  58. /m:<machine> is the name of the computer.
  59. Default is the local computer.
  60. /o:<columns> is the output column list. Default is path.
  61. /p:<scope> is the scope path of the query, absolute or relative.
  62. /q specifies to execute quietly.
  63. Display only query results.
  64. /r:# is the number of times to repeat the command.
  65. /s:<sort> is the sort column list. Default is none.
  66. For example: write[d]. Append [a] for ascending
  67. (default) or [d] for descending.
  68. /t specifies to display catalog statistics.
  69. /u specifies to check if the catalog is up to date.
  70. /x:<maxhits> is the maximum number of hits to retrieve.
  71. Default is no limit.
  72. Programming Notes
  73. =================
  74. VBSQuery and JSQuery
  75. --------------------
  76. The query executed by these scripts is embedded in the script. The query
  77. uses the Query Helper API and consists of the following.
  78. * Columns = filename, directory, size, write
  79. * Query = #filename *.asp
  80. * GroupBy = directory[a]
  81. * Catalog = system
  82. * CiScope = \
  83. * CiFlags = DEEP
  84. * OptimizeFor = recall,hitcount
  85. * AllowEnumeration = True
  86. * MaxRecords = 20000
  87. The JSQuery is a direct translation of the VBSQuery script
  88. to JScript. Its output is identical to that of VBSQuery except
  89. for a difference in the way dates and times are represented.
  90. QSample.vbs
  91. -----------
  92. QSample uses the Query Helper API and is much more general and
  93. flexible than the VBSQuery and JSQuery scripts. It also uses
  94. the Admin Helper API to perform some managing tasks.
  95. Arguments
  96. ---------
  97. You can specify the following columns with the /o argument.
  98. * attrib
  99. * create
  100. * directory
  101. * docauthor
  102. * dockeywords
  103. * doclastauthor
  104. * docsubject
  105. * doctitle
  106. * fileindex
  107. * filename
  108. * hitcount
  109. * path
  110. * rank
  111. * size
  112. * vpath
  113. * workid
  114. * write
  115. You can specify the following locales with the /e argument.
  116. * af
  117. * ar ar-ae ar-bh ar-dz ar-eg ar-iq ar-jo ar-kw ar-lb
  118. ar-ly ar-ma ar-om ar-qa ar-sa ar-sy ar-tn ar-ye
  119. * be bg ca cs da
  120. * de de-at de-ch de-li de-lu
  121. * en en-au en-bz en-ca en-gb en-ie en-jm en-nz en-tt
  122. en-us en-za
  123. * es es-ar es-bo es-c es-co es-cr es-do es-ec es-gt
  124. es-hn es-mx es-ni es-pa es-pe es-pr es-py es-sv
  125. es-uy es-ve
  126. * et eu fa fi fo
  127. * fr fr-be fr-ca fr-ch fr-lu
  128. * gd gd-ie
  129. * he hi hr hu in is
  130. * it it-ch
  131. * ja ji ko ko lt lv mk ms mt n neutr
  132. * nl-be
  133. * no p
  134. * pt pt-br
  135. * rm
  136. * ro ro-mo
  137. * ru ru-mo
  138. * s sb sk sq sr
  139. * sv sv-fi
  140. * sx sz th tn tr ts uk ur ve vi xh
  141. * zh-cn zh-hk zh-sg zh-tw
  142. * zu
  143. Example Queries
  144. ---------------
  145. cscript qsample.vbs mango /o:size,path
  146. Finds all files in the "system" catalog on the local computer that
  147. contain the word "mango" and outputs the size and path values.
  148. cscript qsample.vbs "peach and not apple"" /s:rank[d] /p:.
  149. Finds all files in the "system" catalog on the local computer with
  150. the relative path "." that contain the word "peach" but not the
  151. word "apple" and outputs the path value sorted in order of
  152. increasing rank.
  153. cscript qsample.vbs "@size > 1000000"" /o:size,path /s:size[a] /m:dogfood
  154. Finds all files in the "system" catalog on the computer "dogfood"
  155. whose size is greater than 1000000 bytes and outputs the size and
  156. path values sorted in order of increasing size.
  157. cscript qsample.vbs "@docauthor joe"" /o:docauthor,path /s:docauthor,path
  158. Finds all files in the "system" catalog on the local computer whose
  159. docauthor property is "joe" and outputs the docauthor and path
  160. values sorted in order of ascending docauthor and then ascending
  161. path.
  162. cscript qsample.vbs apricot /p:c:\\files
  163. Finds all files in the "system" catalog on the local computer with
  164. an absolute scope of c:\files and outputs the path in unsorted order.
  165. cscript qsample.vbs /m:index1 /c:sources pear
  166. Finds all files in the "sources" catalog on the computer "index1"
  167. containing the word "pear" and outputs the path value in unsorted
  168. order.