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.

101 lines
4.0 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) 1997-1999 Microsoft Corporation. All Rights Reserved.
  9. //
  10. // Sample Name: AdvQuery - Sample Advanced Query Application
  11. //
  12. //--------------------------------------------------------------------------
  13. Description
  14. ===========
  15. The AdvQuery sample is an example command-line application written in C++
  16. that executes a query using the OLE DB Provider interfaces such as ICommand
  17. and ICommandTree. It shows how to specify a catalog, machine name, and
  18. scope. It can also display the OLE DB command tree for the query.
  19. Path
  20. ====
  21. Source: mssdk\samples\winbase\indexing\AdvQuery\
  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 sample.
  31. 4. Build the sample by entering, at the command-line prompt, "nmake".
  32. * To issue a query to Indexing Service 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. advquery <query> [/c:<catalog>] [/m:<machine>] [/s:<scope>] [/d]
  39. where
  40. <query> is a query in the Indexing Service Query Language
  41. <catalog> is the name of the catalog (default is "system")
  42. <machine> is the name of the machine (default is ".")
  43. <scope> is the root path (default is entire catalog)
  44. /d displays the DBCOMMANDTREE (default is don't display)
  45. Programming Notes
  46. =================
  47. The sample prints the rank, size, and path of each file that matches the
  48. query. The query results are sorted by rank (how well the file matches
  49. the query).
  50. This example is more complex than the Simple (QSample) sample because it
  51. creates a command tree and use the low-level ICommandTree interface
  52. instead of using the OLE DB Helper functions CICreateCommand and
  53. CITextToFullTree.
  54. Parameters
  55. ----------
  56. The <query> parameter can be a word or a phrase. Files that contain the
  57. word or phrase are listed in the result. To include a space in a query,
  58. enclose the query in quotes.
  59. The <catalog> parameter is the name of the catalog to be queried. The
  60. default is "system", which is the default catalog installed with Windows
  61. 2000. Additional catalogs can be created with the Indexing Service
  62. snap-in of the Microsoft Management Console (MMC).
  63. The <machine> parameter is the name of the machine on which the query
  64. will be executed. The default is ".", which is the local machine.
  65. Machine names should not be preceeded with two backslashes.
  66. The <scope> parameter is the file path under which files must exist
  67. to be included in the results. The default is "\", which includes all
  68. scopes in the catalog.
  69. The "/d" parameter displays the DBCOMMANDTREE structure built to execute
  70. the query.
  71. Examples
  72. --------
  73. advquery foo
  74. Finds all files in the "system" catalog on the local machine that
  75. contain the word "foo".
  76. advquery "foo bar" "/s:c:\my directory"
  77. Finds all files in the "system" catalog on the local machine that
  78. contain the phrase "foo bar" that are in the specified directory
  79. or any subdirectory.
  80. advquery foo /m:SERVERNAME
  81. Finds all files in the "system" catalog on machine "servername" that
  82. contain the word "foo".