Share via


Set Properties of the Query Object

Note

Indexing Service is no longer supported as of Windows XP and is unavailable for use as of Windows 8. Instead, use Windows Search for client side search and Microsoft Search Server Express for server side search.

 

This code segment sets several properties of the objQ Query object. The Columns property specifies to return the filename, directory, size, and write time columns in the results, and the GroupBy property specifies to group the results in a hierarchical recordset by values of the directory column in ascending order. This creates a query with a parent recordset consisting of directory names and the chaptered file name, size, and write time columns. The chaptered columns are a child recordset of the parent directory.

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;

The Query property specifies the query text "#filename *.asp", which is in query language Dialect 1 by default, and which is a pattern-matching query that uses a UNIX-style regular expression.