As I am continuing to migrate our ASP app to ASP.Net, it has finally come time to address the Indexing Service search. It’s a big feature in the application, and the transition of this piece needs to be seamless. We want to stick with Ixsso for the Indexing Service as opposed to using the Oledb driver. Ixsso is considered to be the faster of the two technologies, even using COM interop (See various of Hilary Cotter’s comments in microsoft.public.inetserver.indexserver). Code snippets for using Ixsso with ASP.Net are pretty sparse compared to using Oledb, so I figured I should post mine. First, I used the IDE to create a reference to the ixsso Control Library dll and let the IDE make the .Net wrapper for the COM object (christened Cisso by the IDE).
Private Function GetIndexResults(ByVal Query As String) As DataTable Dim impContext As WindowsImpersonationContext = impersonateAnonymous()
Dim Q As New CissoQueryClass
Dim util As CissoUtilClass
Dim da As New OleDbDataAdapter
Dim ds As New DataSet(“IndexServerResults”)
Q.Query = Query
Q.SortBy = “rank[d]”
Q.Columns = “filename, rank, write”
Q.Catalog = “query://DocumentServer/Resumes”
Q.MaxRecords = 1000
util.AddScopeToQuery(Q, “\”, “deep”)
Q.LocaleID = util.ISOToLocaleID(“EN-US”)
da.Fill(ds, Q.CreateRecordset(“nonsequential”), “IndexServerResults”)
Q = Nothing
util = Nothing
Private Function GetIndexResults(ByVal Query As String) As DataTable
Dim impContext As WindowsImpersonationContext = impersonateAnonymous()
The impersonateAnonymous function is described in a previous post of mine. In our case the anonymous user on the machine has appropriate privledges to query the remote Indexing Service, but the ASP.Net worker process does not so impersonation is in order for the function. That part is probably optional depending on the situation. The rest of it is not very tricky. I tried to fill the DataTable directly without the DataAdapter, but that didn’t work. The CreateRecordset function of the CissoQueryClass returns an ADO recordset and I couldn’t find a cast that worked. The DataAdapter seems to be doing the casting work during the call to Fill.
2 Replies to “Query the Indexing Service with Ixsso and ASP.Net”
This post was originally referenced by Jeff Attwood (Coding Horror at http://www.codinghorror.com/blog/2005/12/getting-started-with-indexing-service.html) at it’s original location: http://www.dotnetjunkies.com/WebLog/davetrux/archive/2004/03/03/8345.aspx
You can see the original post at: http://web.archive.org/web/20070208020015/http://www.dotnetjunkies.com/WebLog/davetrux/archive/2004/03/03/8345.aspx
Comments are closed.