Using Remote Search in Vista
Windows Vista includes a new Windows Search service (WSearch) that replaces the Content Indexing service (CiSvc) found on previous versions of Microsoft Windows. This new service delivers improved search performance, a more granular query language, and search-as-you-type (or “wordwheel”) functionality. One feature Windows Search offers that is not as well known is the ability to search content stored on network locations, such as shared folders hosted on file servers.
Let’s begin with the following scenario: Bob has a desktop computer running Windows Vista with Service Pack 1. There are a number of documents stored on a share named STUFF that is located on a network file server running Windows Server 2008 (Figure 1).
Figure 1: Bob is browsing STUFF on FILESRV.
Bob wants to find a document with “vitae” in its filename, so he starts typing the word into the Instant Search box at the top left of the Explorer window. Lo and behold, even before he has finished typing his query, the results he wants are displayed (Figure 2).
Figure 2: Bob finds the document he wants using the “search as you type” capability of Windows Search.
This is cool, but there’s a problem: A yellow information bar appeared when Bob performed his search that says, “Network locations and connected devices are searched more slowly than indexed locations.” What does that mean? It means Windows Search has used the same slow “grep” (Global Regular Expression Print) method of searching for files that Windows XP’s Search Companion used for searching network locations. We’ll see how to get around this in a moment.
Bob now tries another search against the STUFF share. This time, Bob needs to find the document that contains the text “quick brown fox” so he types this phrase into the Instant Search box. No results are displayed (Figure 3).
Figure 3: Where’s the quick brown fox?
That’s to be expected because the initial search looks for a file named “quick brown fox” and not for a file containing this phrase. To search for a file that contains the phrase, Bob clicks the Search In File Contents link in Figure 3 and quickly finds the file he wants (Figure 4).
Figure 4: The fox isn’t quick enough to get away from Windows Search!
So far, there’s nothing new. Both of the searches described above (searching for a filename and for the contents of a file) used the same grep search used by the Search Companion in Windows XP. And if STUFF has a lot of large documents in it, these queries can take a long time to complete.
But if Windows Vista is on the client side and Windows Server 2008 is on the server side, you can make remote searches against network shares work a lot faster than the method used above. The trick to making this happen is to install the Windows Search service on Windows Server 2008 file server. To do this, add the Windows Search Service role service to the File Services role on the server, a task than can be done using the Add Role Services Wizard, which can be launched from Server Manager (Figure 5).
Figure 5: Adding the Windows Search Service role service to a Windows Server 2008 file server
Once you’ve added this role service to the server, the Windows Search service will index the contents of the files stored on the server. This has two benefits: First, it lets you search for files stored on the server while you are logged on to the server. But second and more important, it allows you to search the contents of shared folders on the server more quickly from another computer on the network that has the Windows Search service running on it (such as a Windows Vista client or another Windows Server 2008 computer that has the Windows Search Service role service installed on it).
This is the way it works: Bob starts typing “vitae” into the Instant Search box on an Explorer window showing the STUFF share on FILESRV. As he types, instead of his computer “grepping” the contents of STUFF on FILESRV, his computer issues a query against the index on the file server. In other words, instead of using its local index to satisfy the query, the Windows Search service on the Vista computer uses the remote index on the file server. This allows the results of Bob’s search to be displayed almost instantaneously because the index on the remote machine is being queried instead of grepping the list of files in the remote directory. And the same is true if Bob tries searching for a file that contains “quick brown fox” or any other string of text — the results are returned almost instantly from the index.
Figure 6: Remote Search works against STUFF because the folder is indexed.
The way to tell that the remote index is being used instead of grep is when the yellow information bar is no longer displayed when you try to perform a search against the remote share. Another way to know that Remote Search is working is that when you type “quick brown fox,” as in the example above, it immediately brings up the right file. In other words, it’s not necessary to click the Search In File Contents link in order to search for text within files because Windows Search automatically searches for both filenames and file contents when typing something in the Instant Search box.
Remote Search is a powerful feature, but for it to work a few conditions must be satisfied. First, the computer performing the search must be running Windows Vista (or Windows Server 2008 with the Windows Search Service role service installed on it). Second, the computer you are performing your search against must be a Windows Server 2008 computer with the Windows Search Service role service installed, or it can be another computer running Windows Vista. And third, the contents of the remote file share must be indexed — that is, the contents must be within the scope of the Windows Search service. In our scenario, we can verify that the STUFF share on FILESRV is indexed by opening Indexing Options in Control Panel, clicking the Modify button and verifying that there is a checkbox beside the folder being shared (Figure 6).
One final note: Remote Search works well in Vista but there’s one limitation. When you open a remote share that you want to search, be sure to open it either by browsing Network in Windows Explorer or by typing a UNC path of the form \\servername\sharename, where servername must be the NetBIOS name of the server, not the server’s IP address or fully qualified domain name (FQDN). For some reason, if you specify a FQDN in your UNC path and then try to search a share, grep is used instead of the remote index.