Welcome to WebmasterWorld Guest from 18.204.48.199

Forum Moderators: ocean10000

Message Too Old, No Replies

Need Replacement for MS Index Service on MS 2012 with Classic ASP (VB)

     
8:06 pm on Jul 20, 2015 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 8, 2004
posts: 60
votes: 0


I have just migrated a website from Server 2003 to Server 2012, and MS Indexing service is not available.
In doing some research, I found that MS Search Service is the 'replacement,' and, as such, I installed it on Server 2012. Beyond this, I haven't found what ASP-Classic (VB) code would be necessary to enable the new Search Service to catalog my documents, as Indexing Service did.

Does MS Search Service have the capability and flexibility to catalog and search documents, and return results in the same way that MS Indexing Service did?

Below is an example of the code that currently calls the MS Indexing Service (on the Windows 2003 server):




 <%
Dim strQuery ' The text of our query
Dim objQuery ' The index server query object
Dim rstResults ' A recordset of results returned from I.S.
Dim objField ' Field object for loop
Dim objUtility

' Retreive the query from the querystring
strQuery = Request.QueryString("CiRestriction")
if strQuery <> "" then
if Request.QueryString("ExactPhrase") = "Yes" then
strQuery = """" & strQuery & """"
end if
end if

' If the query isn't blank them proceed
If strQuery <> "" Then
' Create our index server object
Set objQuery = Server.CreateObject("IXSSO.Query")

' Set its properties

objQuery.Catalog = "Test_Docs" ' Catalog to query
objQuery.MaxRecords = 75 ' Max # of records to return
objQuery.SortBy = "Rank[d], size"
objQuery.Columns = "Characterization, DocTitle, Directory, Filename, Path, Rank, Size, Vpath, Write"

' Build our Query: Hide admin page and FPSE pages
'strQuery = "(" & strQuery & ")" _
'& " AND NOT #filename = *admin*" _
'& " AND NOT #path *\_vti_*"

' Uncomment to only look for files modified last 5 days
'strQuery = strQuery & " AND @write > -5d"

' To set more complex scopes we use the utility object.
' You can call AddScopeToQuery as many times as you need to.
' Shallow includes just files in that folder. Deep includes
' subfolders as well.
'

Set objUtility = Server.CreateObject("IXSSO.Util")
objUtility.AddScopeToQuery objQuery, "d:\test_shares\test_docs", "deep"
objQuery.Query = strQuery ' Query text

Set rstResults = objQuery.CreateRecordset("nonsequential") ' Get a recordset of our results back from Index Server

' Check for no records
If rstResults.EOF Then
Response.Write "Sorry. No results found."
Else
' Print out # of results
Response.Write "<p><strong>"
Response.Write rstResults.RecordCount
Response.Write "</strong> results found:</p>"

' Loop through results
Do While Not rstResults.EOF
' Loop through Fields
' Pretty is as pretty does... good enough:
%>
<%KSize=formatnumber(rstResults.Fields("size"))
KSize= round(KSize/1024,0)%>
<p>
<%'test below using PoorMansIsNull function%>
<% If PoorMansIsNull(rstResults.Fields("DocTitle")) Or rstResults.Fields("DocTitle")="" Then %>

<a href="/ams/test_docs<%= PathToVpath(rstResults.Fields("path")) %>" target="_blank"><%= PathToVpath(rstResults.Fields("filename")) %></a>
<% Else %>
<a href="/ams/test_docs<%= PathToVpath(rstResults.Fields("path")) %>" target="_blank"><font size="3"><%= rstResults.Fields("DocTitle") %></font></a>
<% End If %>

<br><%= rstResults.Fields("Characterization") %><br>

<font color="#009900"><%= PathToVpath(rstResults.Fields("path")) %> - <%= KSize %>k<br /></font>
</p>
<%

' Move to next result
rstResults.MoveNext
Loop

rstResults.MoveFirst
Response.Write "<pre>"
'Response.Write rstResults.GetString()
Response.Write "</pre>"
End If

' Kill our recordset object
Set rstResults = Nothing
Set objUtility = Nothing
Set objQuery = Nothing
End If
%>


</body>
</html>
<%
Function PathToVpath(strPath)
Const strWebRoot = "d:\test_shares\test_docs\"

Dim strTemp

strTemp = strPath

strTemp = Replace(strTemp, strWebRoot, "\")
strTemp = Replace(strTemp, "\", "/")

PathToVpath = strTemp
End Function
%>

And, the results would be listed, per document (the name of the document, with excerpt from document text, along with title, size).

Thanks for any leads and/or alternatives.
8:22 pm on Aug 24, 2015 (gmt 0)

Senior Member

WebmasterWorld Senior Member bwnbwn is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 25, 2005
posts:3604
votes: 54


Couple of reads that will steer you in the right direction.

[forums.iis.net...]

[stackoverflow.com...]

Cheers joe
1:59 pm on Sept 1, 2015 (gmt 0)

Junior Member

10+ Year Member

joined:May 10, 2003
posts: 58
votes: 0


What kind of documents are you indexing?

I would look at integrating an external (non MS) indexer and search engine.

[sphinxsearch.com...] is a great one and although the implementation might not be trivial, it is well worth it.

We are using it to index and search ten of millions of documents and accessing it (kinda) using classic ASP.