//+--------------------------------------------------------------------- // // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A // PARTICULAR PURPOSE. // // Copyright 1999, Microsoft Corporation. All Rights Reserved. // // SCRIPT: JSQuery // // PURPOSE: Illustrates how to execute an Indexing Service query // using Microsoft JScript. The query uses the GroupBy // property of the Query object to create a chaptered // recordset of all files of a specified type in all // directories that contain the specified file type. // // PLATFORM: Windows 2000 // //---------------------------------------------------------------------- var strGroupBy; // Name of GroupBy column. var intI, intJ; // Index variables. var objQ; // Query object. var strRecord; // Output record of query results. var objRS_Child; // Child RecordSet object. var objRS_Parent; // Parent RecordSet object. var intRS_Child_Count; // Number of current record of child RecordSet. var intRS_Parent_Count; // Number of current record of parent RecordSet. var objU; // Utility object. // Create a Query object. objQ = new ActiveXObject("IXSSO.Query"); // Set the properties of the Query object. objQ.Columns = "filename, directory, size, write"; objQ.Query = "#filename *.asp"; objQ.GroupBy = "directory[a]"; objQ.Catalog = "system"; objQ.OptimizeFor = "recall"; objQ.AllowEnumeration = true; objQ.MaxRecords = 20000; // Create a Utility object. objU = new ActiveXObject("IXSSO.Util"); // Add the physical path and all subdirectories. objU.AddScopeToQuery(objQ, "\\", "deep"); // Output the Query properties. WScript.Echo(" Columns = " + objQ.Columns); WScript.Echo(" Query = " + objQ.Query); WScript.Echo(" GroupBy = " + objQ.GroupBy); WScript.Echo(" Catalog = " + objQ.Catalog); WScript.Echo(" CiScope = " + objQ.CiScope); WScript.Echo(" CiFlags = " + objQ.CiFlags); WScript.Echo(" OptimizeFor = " + objQ.OptimizeFor); WScript.Echo(" AllowEnumeration = " + objQ.AllowEnumeration); WScript.Echo(" MaxRecords = " + objQ.MaxRecords); // Create a parent (grouped) RecordSet object for the Query. objRS_Parent = objQ.CreateRecordSet("nonsequential"); // Determine the name of the GroupBy column. strGroupBy = ""; for (intI=0; intI