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.

163 lines
6.5 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) 1998-1999 Microsoft Corporation. All Rights Reserved.
  9. //
  10. // Sample Name: Simple (QSample) - Sample Indexing Service Application
  11. //
  12. //--------------------------------------------------------------------------
  13. Description
  14. ===========
  15. The Simple sample (QSample) is an example command-line application written
  16. in C++ that executes a query using the OLE DB Helper API functions
  17. CCreateICommand and CITextToFullTree to simplify the coding needed to
  18. create a query to an Indexing Service catalog.
  19. Path
  20. ====
  21. Source: mssdk\samples\winbase\indexing\Simple\
  22. User's Guide
  23. ============
  24. * To build the sample
  25. 1. Set the Lib environment variable to "D:\mssdk\Lib;%Lib%" and the
  26. Include environment variable to "D:\mssdk\Include;%Include%",
  27. where D: is the drive on which you installed the Platform SDK.
  28. 2. Correctly set the CPU environment variable to, for example, "i386".
  29. 3. Open a command window and change the directory to the source path
  30. of the example.
  31. 4. Build the example by entering, at the command-line prompt, "nmake".
  32. * To execute queries using the sample
  33. 1. Open a command window and change the directory to the path of the
  34. built sample.
  35. 2. Formulate a query that you know will succeed. You need to know the
  36. machine, catalog, scope, and query text.
  37. 3. Submit the query by entering, at the command-line prompt,
  38. qsample <query> [arguments]
  39. where
  40. <query> is an Indexing Service query.
  41. and the arguments can optionally include:
  42. /c:<catalog> is the name of the catalog.
  43. Default is "system".
  44. /d specifies to display the command tree.
  45. Default is not to display.
  46. /e:<locale> is ISO locale identifier, e.g. EN-US.
  47. Default is system locale.
  48. /f:(+|-) + or - specifies forcing use of the index.
  49. Default is +.
  50. /g specifies forcing a master merge.
  51. /i:<inputfile> specifies an input file to read with queries,
  52. one per line.
  53. /j specifies to return just files in the scope path,
  54. and not subdirectories.
  55. /l:<dialect> specifies the query language dialect, 1 or 2.
  56. Default is 1.
  57. /m:<machine> is the name of the computer.
  58. Default is the local computer.
  59. /o:<columns> is the output column list. Default is path.
  60. /p:<scope> is the scope path of the query, absolute or relative.
  61. /q specifies to execute quietly.
  62. Display only query results.
  63. /r:# is the number of times to repeat the command.
  64. /s:<sort> is the sort column list. Default is none.
  65. For example: write[d]. Append [a] for ascending
  66. (default) or [d] for descending.
  67. /t specifies to display catalog statistics.
  68. /u specifies to check if the catalog is up to date.
  69. /x:<maxhits> is the maximum number of hits to retrieve.
  70. Default is no limit.
  71. Programming Notes
  72. =================
  73. This example is simpler than the AdvQuery sample because it uses the
  74. OLE DB Helper functions CICreateCommand and CITextToFullTree instead of
  75. creating a command tree and using the low-level ICommandTree interface.
  76. Arguments
  77. ---------
  78. You can specify the following columns with the /o argument.
  79. * attrib
  80. * create
  81. * directory
  82. * docauthor
  83. * dockeywords
  84. * doclastauthor
  85. * docsubject
  86. * doctitle
  87. * fileindex
  88. * filename
  89. * hitcount
  90. * path
  91. * rank
  92. * size
  93. * vpath
  94. * workid
  95. * write
  96. You can specify the following locales with the /e argument.
  97. * af
  98. * ar ar-ae ar-bh ar-dz ar-eg ar-iq ar-jo ar-kw ar-lb
  99. ar-ly ar-ma ar-om ar-qa ar-sa ar-sy ar-tn ar-ye
  100. * be bg ca cs da
  101. * de de-at de-ch de-li de-lu
  102. * en en-au en-bz en-ca en-gb en-ie en-jm en-nz en-tt
  103. en-us en-za
  104. * es es-ar es-bo es-c es-co es-cr es-do es-ec es-gt
  105. es-hn es-mx es-ni es-pa es-pe es-pr es-py es-sv
  106. es-uy es-ve
  107. * et eu fa fi fo
  108. * fr fr-be fr-ca fr-ch fr-lu
  109. * gd gd-ie
  110. * he hi hr hu in is
  111. * it it-ch
  112. * ja ji ko ko lt lv mk ms mt n neutr
  113. * nl-be
  114. * no p
  115. * pt pt-br
  116. * rm
  117. * ro ro-mo
  118. * ru ru-mo
  119. * s sb sk sq sr
  120. * sv sv-fi
  121. * sx sz th tn tr ts uk ur ve vi xh
  122. * zh-cn zh-hk zh-sg zh-tw
  123. * zu
  124. Example Queries
  125. ---------------
  126. qsample mango /o:size,path
  127. Finds all files in the "system" catalog on the local computer that
  128. contain the word "mango" and outputs the size and path values.
  129. qsample "peach and not apple" /s:rank[d] /p:.
  130. Finds all files in the "system" catalog on the local computer with
  131. the relative path "." that contain the word "peach" but not the
  132. word "apple" and outputs the path value sorted in order of
  133. increasing rank.
  134. qsample "@size > 1000000" /o:size,path /s:size[a] /m:dogfood
  135. Finds all files in the "system" catalog on the computer "dogfood"
  136. whose size is greater than 1000000 bytes and outputs the size and
  137. path values sorted in order of increasing size.
  138. qsample "@docauthor joe" /o:docauthor,path /s:docauthor,path
  139. Finds all files in the "system" catalog on the local computer whose
  140. docauthor property is "joe" and outputs the docauthor and path
  141. values sorted in order of ascending docauthor and then ascending
  142. path.
  143. qsample apricot /p:c:\\files
  144. Finds all files in the "system" catalog on the local computer with
  145. an absolute scope of c:\files and outputs the path in unsorted order.
  146. qsample /m:index1 /c:sources pear
  147. Finds all files in the "sources" catalog on the computer "index1"
  148. containing the word "pear" and outputs the path value in unsorted
  149. order.