4

Web サイトを Server 2003 から Server 2012 に移行したばかりですが、MS インデックス サービスを利用できません。
いくつかの調査を行ったところ、MS Search Service が「代替品」であることがわかりました。そのため、Server 2012 にインストールしました。これを超えて、有効にするために必要な ASP-Classic (VB) コードが見つかりませんでした。 Indexing Service が行ったように、ドキュメントをカタログ化するための新しい Search Service。

MS Search Service には、MS Indexing Service と同じように、ドキュメントをカタログ化して検索し、結果を返す機能と柔軟性がありますか?

以下は、現在 (Windows 2003 サーバー上で) MS インデックス サービスを呼び出すコードの例です。

<%
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
%>

また、以下に示すように、結果はドキュメント (ドキュメントの名前、ドキュメント テキストからの抜粋、タイトル、サイズ) ごとに一覧表示されます。 ここに画像の説明を入力

リードや代替案をありがとう。

4

2 に答える 2

1

私は同じ問題に直面しています。この問題に関する MS ガイドを見つけました: Querying the Index with Windows Search SQL Syntax

この ASP (クラシック) コードをテストしたところ、問題なく動作しました。

<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>

他の選択肢:

  1. Windowsサーバーにasp dllを登録してみてください。私が見ることができたのは、誰もこのアプローチの成功に関係していないことです。この投稿を参照してください。
  2. ASP をサポートする以前の Windows バージョンの VM を作成します。このMS の記事を参照してください。

それがあなたを助けることを願っています。

于 2016-12-01T15:59:07.930 に答える