Part I: How Did Google Become a Verb?
I love Google.com. It appeals to the obscurantist in me. Navigate to google.com and you get a simple textbox and a button. Enter anything you fancy and google.com comes back with a plethora of choices. It's great, and the name is great. Google is as cool as the name Starbuck (from Moby Dick, I think), and Amazon.com. But, how did the word "google" become a verb in the English lexicon?
The answer, I think, is that the word google is catchy, has nothing to do what it is (the Starbuck's factor), and Google.com is extremely easy to use. (I am ashamed to admit this, but my homepage at my current contract site is msn.com, and I frequently switch to google.com to perform searches.)
In Part I of this article, we will configure and prepare the Indexing Service. In Part II, later this month, I will demonstrate how to incorporate the Indexing Service into an ASP.NET Web page using VB.NET to code the solution.
Configuring Microsoft Indexing Service
Microsoft Indexing Service is the service application behind tools such as Windows Explorer. By tapping into this service, one can provide free text searching capabilities to Web surfers. For me, this is a great way to make source code, previous articles, and various and sundry tidbits more accessible to browsers (at www.softconcepts.com).
Without going into a lot of detail (and without me having to do a lot of research), the MS Indexing Service creates a digital index of files, locations, and contents. This behavior supports tools such as Windows Explorer. If we want to use the Indexing Service, we need to ensure that the service is running. To turn on the Indexing Service on your PC (or Web server), follow these steps:
- Click Start|Program Files|Control Panel|Administrative Tools|Computer Management.
- Expand the Services and Applications tab (see Figure 1).
- Select the Indexing Service.
- And, click the VCR-like play button (also shown in Figure 1).
Figure 1: The Microsoft Indexing Service in the Computer Management console.
After the last step, the index service is running and ready to work for you and your Web site.
You can test the Indexing Service in the console directly. As shown in Figure 2, you can select the Query the Catalog node and an Indexing Service Query Form is displayed. In the example, I tested the word "footer," which yielded the results shown at the bottom of Figure 2.
Figure 2: Testing the Indexing Service in the Management Console.
Associating the Indexing Service with SQL Server
As I write this, I haven't had the chance to determine whether ADO.NET directly supports MS Indexing Service. Thanks to Mr. Walther, I do know that you can use the Indexing Service through SQL Server, and this approach works pretty well. Using SQL Server makes it easy to send SQL-like queries to MS Indexing Service through SQL Server.
To link MS SQL Server with MS Indexing Service open MS Query Analyzer (you will need Microsoft SQL Server Client tools installed) and follow these steps:
- Start Query Analyzer from Start|All Programs|Microsoft SQL Server|Query Analyzer).
- In a new Query entry form (see Figure 3), run the following query:
- Click the Execute Query button or press F5 to run the query.
EXEC sp_addlinkedserver FileSystem, 'Index Server', 'MSIDXS', 'Web'
Figure 3: Linking the Indexing Service to SQL Server using the MS Query Analyzer.
The Indexing Service should now be accessible through SQL Server and consequently ADO.NET and your Web application.
Testing Search Support with MS Query Analyzer
Before we commence modifying and updating our ultra cool ASP.NET-based Web Application, we can test the Indexing Service. We can perform the test with several tools, including Query Analyzer, which is open already if you are following along.
The following query was executed in Query Analyzer. It yields roughly the same results that we saw in the Indexing Service Query Form earlier.
SELECT * FROM OPENQUERY(FileSystem, 'SELECT FileName, Characterization FROM SCOPE() WHERE FREETEXT(''footer'') > 0')
There are a couple dozen column values in the Index Service database. In second half of this article, I will demonstrate enough of the Index Services' columns for you to implement a usable search page in your Web application. For comprehensive coverage of these columns, Microsoft Indexing Service, and much more, I refer you to Stephen Walther's book.
It is amazing how useful the Internet is. I use the Internet for e-mail, daily news, pizza dough recipes, my daily work, unabashedly for multiplayer video games, and most of my purchases. I can do all of these things because great yet simple tools such as google.com, msn.com, and amazon.com make it easy to find what I am looking for.
If you are publishing content—anything from poetry or graphics to source code or technology articles—adding search capabilities to your Web site will make it more likely that consumers who find your Web site will also find what they are searching for.
In this article, we turned on Microsoft's Indexing Service and associated this service with SQL Server. As a result, we will be able to use .NET to handsomely incorporate free-text searching into our own Web sites. While Google.com or MSN.com may not index everything on your Web site, with this solution, once a browser finds your Web site, they will be able to find everything available there.
About the Author
Paul Kimmel is the VB Today columnist for codeguru.com and developer.com and has written several books on object-oriented programming, including the recently released Visual Basic .NET Power Coding from Addison-Wesley and the upcoming Excel VBA 2003: Programmer's Reference from Wiley. He is the chief architect for Software Conceptions and is available to help design and build your next application.
As an aside, many of you may not know that Michigan is in the top ten in IT spending in the US and perhaps the world. The dollar amount is astronomical, way into the billions of dollars. Resultantly, we get great shows like Microsoft's DevDays—during the first week of March 2004 this year—in Detroit. The cost is less than $100, making this show accessible to everyone. (Register early and the cost is $75.) You will have the opportunity to make a lot of great contacts, learn about killer Microsoft technologies, get a paid day or two out of the office, and as a presenter, I will get the opportunity for a lot of you to tell me what I still don't know.
Finally, the Lansing, Michigan area has a great opportunity to form a .NET Users Group. A well-run group offers great learning and networking opportunities and occasionally some free pizza and door prizes. Contact me at firstname.lastname@example.org if you are interested in participating.
# # #