Windows Server 2008 R2 and Indexing service.

I was hanging out in the http://forums.iis.net, and a question came up regarding the Indexing Service on Windows Server 2008.   The indexing service has been handy when providing search capabilities in prior versions of IIS.  It's not www.bing.com or www.google.com like, but provides basic search.  Microsoft was kind enough to hide it from the web server role and add to the File Services Role.  Open Server Manager, Click Roles, Select File Services and select option showed.   I found an article http://support.microsoft.com/kb/954822 that describes using Indexing Server in greater detail along with some limitations.  From my initial testing, it seemed to work as before when I tested on Windows 2000/2003.

Here is how you management

  Here is an updated webpage with code.

Webpage

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="search.aspx.vb" Inherits="_WebForm1" %>

<HTML>
<HEAD>
<title>Query an Indexing Service Catalog</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
        <asp:TextBox id="TextBox1" style="Z-INDEX: 101; LEFT: 238px; POSITION: absolute; TOP: 76px" runat="server"></asp:TextBox>
        <asp:DataGrid id="DataGrid1" style="Z-INDEX: 102; LEFT: 153px; POSITION: absolute; TOP: 127px"
runat="server" AutoGenerateColumns="False">
    <Columns>
        <asp:BoundColumn DataField="DocTitle" HeaderText="DocTitle"></asp:BoundColumn>
        <asp:BoundColumn DataField="filename" HeaderText="FileName"></asp:BoundColumn>
        <asp:BoundColumn DataField="size" HeaderText="Size"></asp:BoundColumn>
        <asp:BoundColumn DataField="path" HeaderText="PATH"></asp:BoundColumn>
        <asp:BoundColumn DataField="url" HeaderText="URL "></asp:BoundColumn>
    </Columns>
</asp:DataGrid>

<asp:Button id="Button1" style="Z-INDEX: 103; LEFT: 638px; POSITION: absolute; TOP: 145px" runat="server"
Text="Button"></asp:Button>
</form>
</body>
</HTML>

Code Behind

Imports System.Data

Partial Class _WebForm1
Inherits System.Web.UI.Page

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim strCatalog As String

' Catalog Name
strCatalog = "IISLogs"

Dim strQuery As String
strQuery = "Select DocTitle,Filename,Size,PATH,URL from SCOPE() where FREETEXT('" & TextBox1.Text & "')"
Dim connString As String = "Provider=MSIDXS.1;Integrated Security .='';Data Source='" & strCatalog & "'"

Dim cn As New System.Data.OleDb.OleDbConnection(connString)
Dim cmd As New System.Data.OleDb.OleDbDataAdapter(strQuery, cn)
Dim testDataSet As New DataSet()

cmd.Fill(testDataSet)

' Bind DataGrid to the DataSet. DataGrid is the ID for the
' DataGrid control in the HTML section.
Dim source As New DataView(testDataSet.Tables(0))
DataGrid1.DataSource = source
DataGrid1.DataBind()
End Sub
End Class

Hope this helps!  Happy Searching

Steve Schofield
Windows Server MVP – IIS
http://www.iislogs.com/steveschofield

http://www.IISLogs.com
Log archival solution
Install, Configure, Forget