Creating a Query Object with the Query Helper API
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 executes when the specified query language is either Dialect 1 or 2 of the Indexing Service query language. The first portion of the code segment uses the CreateObject function to create Q, a Query object, and to create Util, a Utility object, from the Query Helper API.
...
If InStr(Dialect.Text, "Dialect") <> 0 Then
' Create the query and execute.
Dim Q As Object
Set Q = CreateObject("ixsso.Query")
Dim Util As Object
Set Util = CreateObject("ixsso.Util")
...
The next portion of the code segment sets several properties of the Q Query object, adds the scope to the query using the AddScopeToQuery method of the Utility object, and sets the selected Dialect for the query.
...
Q.Query = QueryText.Text
Q.Columns = "Filename, Path, Size, Write"
If Sort.ListIndex = 2 Then
Q.SortBy = "Rank[d]"
Else
Q.SortBy = Sort.Text
End If
Util.AddScopeToQuery Q, Scope.Text, "DEEP"
If 0 = sc Then
Q.Catalog = CatalogName.Text
End If
If StrComp(Dialect.Text, "Dialect 2") = 0 Then
Q.Dialect = 2 ' Dialect 2.
Else
Q.Dialect = 1 ' Dialect 1.
End If
...