© 2004 Microsoft Corporation. All rights reserved.
Figure 6

Executing the Query


Set m_objCmd = Server.CreateObject("ADODB.Command") 
Set m_objRs = Server.CreateObject("ADODB.RecordSet")

Set m_objCmd.ActiveConnection = m_objCn

m_objCmd.CommandText = "SELECT ""DAV:displayname"" AS DisplayName, 
   ""DAV:href"" AS HRef, ""urn:schemas-microsoft-com:
   office:office#Title"" AS Title, " &_ 
   """urn:schemas.microsoft.com:fulltextqueryinfo:description"" 
   AS Description, ""urn:schemas.microsoft.com:fulltextqueryinfo:rank"" 
   AS RANK, " & _ " CAST(""DAV:getlastmodified"" AS DATE) 
   AS LastModified " & _ " FROM SCOPE('DEEP TRAVERSAL OF " & Chr(34) &
   m_strScope & Chr(34) & "') WHERE FREETEXT('" & m_strSearch  & "') " &_ 
   " AND (""urn:schemas.microsoft.com:fulltextqueryinfo:rank"" > 10)
   ORDER BY ""urn:schemas.microsoft.com:fulltextqueryinfo:rank"" DESC"

m_objRs.Open m_objCmd
Figure 7

Verifying the New Record Position


If Not m_objRs.EOF Then

For m_intRecord = 1 To SEARCH_RANGESIZE

   m_strResultXML = m_strResultXML & "<RESULT RANK='" & 
   m_objRs.Fields("Rank").value  & "' "
   m_strResultXML = m_strResultXML & "HREF='" & 
   m_objRs.Fields("HREF").Value & "'> "
   m_strResultXML = m_strResultXML  & "</RESULT>"

   m_objRs.MoveNext
   If m_objRs.EOF Then Exit For
Next    
End If
Figure 8

The Search Request


m_strRequest =  &_
   "<?xml version='1.0'?>" &_
   "<D:searchrequest xmlns:D = 'DAV:'>" &_
   "<D:sql>" &_
   "SELECT ""DAV:contentclass"",
   ""urn:schemas.microsoft.com:fulltextqueryinfo:description""," &_
   """DAV:href"", ""DAV:displayname"", 
   ""urn:schemas-microsoft-com:office:office#Title""," &_
   """urn:schemas.microsoft.com:fulltextqueryinfo:rank"", 
   CAST(""DAV:getlastmodified"" AS DATE) " &_    
   " FROM SCOPE('DEEP TRAVERSAL OF " & Chr(34) & m_strScope & 
   Chr(34) & """)" &_
    "') WHERE FREETEXT('" & m_strSearch & "') AND   
   (""urn:schemas.microsoft.com:fulltextqueryinfo:rank"" &gt; 10)" &_             
   " ORDER BY ""urn:schemas.microsoft.com:fulltextqueryinfo:rank"" 
   DESC" &_
   "</D:sql>" &_ "</D:searchrequest>"
Figure 9

Sample Response XML


<?xml version="1.0" encoding="UTF-8" ?> 
<a:multistatus xmlns:a= "DAV:" xmlns:b= "urn:uuid:c2f41010-65b3-11d1-
  a29f-00aa00c14882/" 
  xmlns:c= "xml:" xmlns:d= "urn:schemas.microsoft.com:fulltextqueryinfo:" 
  xmlns:e= "urn:schemas-microsoft-com:office:office" 
  xmlns:f= "urn:schemas-microsoft-com:publishing:"
>
<a:response>     
    <a:href>http://www.microsoft.com/sharepoint/docs/
      sharepointdocument.doc</a:href>
    <a:propstat>
    <a:status>HTTP/1.1 200 OK</a:status>
    <a:prop>
          <e:Title>This document does not exist</e:Title>
          <d:rank b:dt="int">197</d:rank>
    </a:prop>
        </a:propstat>
        <a:propstat>
    <a:status>HTTP/1.1 404 Resource Not Found</a:status> 
           <a:prop>
        <f:Categories /> 
        <f:BestBetKeywords /> 
          </a:prop>
        </a:propstat>    
</a:response>
<a:response>
   <a:href>http://www.microsoft.com/sharepoint/default.htm</a:href>
   <a:propstat>
      <a:status>HTTP/1.1 200 OK</a:status>
      <a:prop>
        <e:Title>SharePoint Portal Server 2001</e:Title>
        <d:rank b:dt="int">165</d:rank>
      </a:prop>
   </a:propstat>
   <a:propstat>
      <a:status>HTTP/1.1 404 Resource Not Found</a:status> 
      <a:prop>
         <f:Categories /> 
         <f:BestBetKeywords /> 
      </a:prop>
   </a:propstat>
</a:response>
</a:multistatus>
Figure 10

Request


"<?xml version=""1.0"" encoding=""utf-8""?>" & _
"<a:searchrequest xmlns:a=""DAV:"">" & _
"  <a:sql>" & _
"SELECT ""urn:schemas-microsoft-com:office:office#Title"",
""urn:schemas-microsoft-com:publishing:Categories"", 
 ""urn:schemas.microsoft.com:fulltextqueryinfo:rank"", 
""urn:schemas-microsoft-com:publishing:BestBetKeywords""
 FROM SCOPE('DEEP TRAVERSAL OF ""http://www.microsoft.com/sharepoint""') 
WHERE FREETEXT('SharePoint')" & _
"  </a:sql>" & _
"</a:searchrequest>"

MSDN Magazine Blog

MSDN Magazine Right Rail

14 Top Features of Visual Basic 14: The Q&A
Leading off the feature in the January issue of MSDN Magazine is Lucian Wischik’s fantastic look at Visual Basic .NET 14. As Wischik writes, the newes... More...
Wednesday, Jan 7
Big Start to the New Year at MSDN Magazine
Folks, things are hopping over here at MSDN Magazine. We are kicking off the new year with a pair of issues: Our regularly scheduled January issue and... More...
Friday, Jan 2

More MSDN Magazine Blog entries >


Receive the MSDN Flash e-mail newsletter every other week, with news and information personalized to your interests and areas of focus.