Necessity of replacement for MS Index Service on server 2012 with classic ASP (VB)

I just migrated the site from server 2003 to server 2012, and the MS indexing service is not available.
While doing some research, I found that the MS Search Service is a "replacement" and, as such, I installed it on Server 2012. In addition, I did not find which ASP-Classic (VB) code is needed to enable the new search service to catalog my documents, as the Indexing Service did.

Does the MS search service have the ability and flexibility to catalog and search for documents and return the same results as the MS indexing service?

The following is an example of the code that is currently invoking the MS Indexing Service (on a 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
%>

( , , , ), : enter image description here

/ .

+4
2

. MS : SQL Windows.

ASP (Classic) :

<html>
<body>
    Results<br>
<ol>
<%
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")

objConnection.Open "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"

'change directory on scope clause
objRecordSet.Open "SELECT Top 20 " & _
     "System.ItemPathDisplay " & _
     ",System.ItemName " & _
     ",System.Size " & _
   "FROM SYSTEMINDEX" & _
   " WHERE SCOPE='file:E:\MANIF\DAAP\AC'", objConnection


objRecordSet.MoveFirst
Do Until (objRecordSet.EOF)
    %>
    <li>
    <strong>Path Display:</strong><%=objRecordSet("System.ItemPathDisplay")%><br>
    <strong>Name:</strong><%=objRecordSet("System.ItemName")%><br>
    <strong>Size:</strong><%=objRecordSet("System.Size")%><br>
    <hr>
    </li>
   <%
   objRecordSet.MoveNext
Loop

objRecordSet.Close
Set objRecordSet = Nothing

objConnection.Close
Set objConnection = Nothing
%>
</ol>
</body>
</html>

:

  • asp dll Windows. , . . ;
  • Windows asp. . MS.

, .

+1

. . :

objRecordSet.Open "SELECT Top 20 " & _
 "System.ItemPathDisplay " & _
 ",System.ItemName " & _
 ",System.Size " & _
 "FROM SYSTEMINDEX", objConnection & _
 "WHERE SCOPE='file:E:\MANIF\DAAP\AC'"

. , , WHERE .

objRecordSet.Open "SELECT Top 20 " & _
 "System.ItemPathDisplay " & _
 ",System.ItemName " & _
 ",System.Size " & _
 "FROM SYSTEMINDEX " & _
 "WHERE SCOPE='file:E:\MANIF\DAAP\AC'", objConnection

, .

+1

Source: https://habr.com/ru/post/1598411/


All Articles