IIS Index Server - Hilary can you help me?

This is Interesting: Free IT Magazines  
Home > Archive > IIS Index Server > February 2004 > Hilary can you help me?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Hilary can you help me?
Brenda

2004-02-12, 6:37 am

Hey guys,

I have asked for help once and no one knows exactly what
I'm talking about or I just don't understand their options.

I'm trying to index Docs directory that's located in
LPserver3. I'm indexing from LPweb, which it's where our
intranet is located at. In LPWeb, the CMC works
perfectly fine, but if I create an ASP search page in
LPWeb, so it can be access by anyone in the company, it
does not return any information. Someone told me about
this link:
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/indexsrv/html/ixuwebov_8mpf.asp , which
it's no help for me because it does not tell me what to do
in my code. Here's the code that I use: (Where I'm having
trouble is the hlink part)Please help me out, I'll really
appreciate your help.


<%
FormScope ="/"
PageSize = 1000
MaxRecords=1000
SearchString = Request.Form("SearchString")
CatalogToSearch = "HDocs"
SearchRankOrder="rank[d]"
OrigSearch=SearchString

set Q = Server.CreateObject("ixsso.Query")
set util = Server.CreateObject("ixsso.Util")
Q.Query = SearchString
Q.Catalog = CatalogToSearch
Q.Sortby = SearchRankOrder
Q.Columns = "DocTitle, vpath, filename, size, write,
characterization, rank, directory, path"
Q.MaxRecords = MaxRecords

util.AddScopeToQuery Q, "/", "deep"

set RS = Q.CreateRecordSet("nonsequential")
RS.PageSize = PageSize
response.write "<p> <font face='Arial' size='2'> Your
search for <b>" & OrigSearch & "</b> yielded "
'response.write "<p> Your Search for <b> & OrigSearch
& "</b> yielded "

If RS.RecordCount=0 then response.write "no results."
If RS.RecordCount=1 then response.write "1 result:"
If RS.RecordCount >1 then response.write RS.RecordCount
& " results:"

response.write "<table border = 1> <tr><td> Document
Title</td><td>Vpath</td><td>Filename</td>"
response.write"<td>Size</td><td>Write</td><td>Characterizat
ion</td><td>Rank</td>"
response.write "<td>Directory</td><td>Path</td></tr>"

Do While Not RS.EOF

hlink = "<a href=""/lpserver3" &RS("Vpath") &RS
("filename") & """>" & RS("doctitle") & "</a>"


response.write "<tr><td>" & hlink & "</td><td>" & RS
("Vpath") & "</td><td>"
response.write RS("filename") & "</td><td>" & RS("size")
& "</td><td>" & RS("write")
response.write "<tr><td>" & RS("characterization")
& "</td><td>" & RS("rank")
response.write "<tr><td>" & RS("directory") & "</td><td>"
& RS("path") & "</td><tr>"

RS.MoveNext
Loop

response.write "</table>"
set rs=nothing
set q=nothing
set util=nothing
%>

..


Andrés Naranjo[MSFT]

2004-02-12, 6:37 am

Brenda,

You are looking to have an ASP page from which you can query an index
server catalog on LPWeb, and get as results a list of documents which
actually reside in LPserver3, correct?

1. Go to LPserver3, and create a share where your content is located. Make
sure you follow the guidelines for setting up the share, as described in
the MSDE link you posted.

2. Then you have to set up a virtual directory on LPWeb, let's assume you
call it VDir1.

3. You then go into the properties of VDir1 (in the IIS MMC), and go to the
Virtual Directory tab.
4. Make sure that the radio button at the top is set to "A share located on
another computer".
5. Provide the path to the share in the format: \\<servername>\<sharename>
6. Make sure that you click on the "Connect As..." button, and provide
credentials which have necessary rights on the target machine and which
have the right NTFS permissions to the content being shared.

7. Once you do this, make sure that the checkbox for Index This Resource in
the same Virtual Directory tab, is checked.

8. You then need to allow your catalog to build, and before you even worry
about the ASP code, open the Index Server MMC on LPWeb, and perform a query
for some of the documents in the remote share.

9. If you get results to your query, and the results are documents from
the remote share, then you will be able to use the Index Server sample
search pages from the Index SDK to query for these documents. The only
thing you might have to change is the catalog name if your catalog is not
named "web".

Looking at your code, it seems like you are trying to manually build a URL
path to the content on the LPserver3 machine here:

hlink = "<a href=""/lpserver3" &RS("Vpath") &RS("filename") & """>" &
RS("doctitle") & "</a>"

However, in our samples, we don't build a path in this manner at all, we
simply output the vPath property, which already has a virtual path (URL) to
the documents, thanks to the fact that the documents are part of a virtual
directory pointed to by IIS.

I am going to try to post the entire text of one of our sample ASP pages in
another post in this thread, and also attach it to the post (if I can
figure out how to do that)... in the mean time, the snippet of code of our
sample that does this is:


<% Do While Not RS.EOF and NextRecordNumber <= LastRecordOnPage

' This is the detail portion for Title, Abstract, URL
' If there is a title, display it, otherwise display the filename.
%>
<p>

<% '*************I am skipping some stuff here************** %>


<tr class="RecordTitle">
<td align="right" valign=top class="RecordTitle">
<%= NextRecordNumber%>.
</td>
<td><b class="RecordTitle">
<%if VarType(RS("DocTitle")) = 1 or RS("DocTitle") = "" then%>
<% ' ********************NOTICE HOW IN THIS NEXT LINE WE JUST USE vPath TO
GET a URL, FOLLOWED BY THE FILE NAME********** %>
<a href="<%=RS("vpath")%>" class="RecordTitle"><%= Server.HTMLEncode(
RS("filename") )%></a>
<%else%>
<a href="<%=RS("vpath")%>" class="RecordTitle"><%=
Server.HTMLEncode(RS("DocTitle"))%></a>
<%end if%>
</b></td>
</tr>
<%
RS.MoveNext
NextRecordNumber = NextRecordNumber+1
Loop
%>






Does this answer your question? Thank you for using Microsoft Newsgroups!

Andrés Naranjo [MSFT]
Microsoft DS Communities Team

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only.

Andrés Naranjo[MSFT]

2004-02-12, 6:37 am

The below sample is a simple ASP search page to query Index Server. It is
in the Windows 2000 SDK, and you are free to use it if you want.
Good luck

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN" "html.dtd">
<HTML>
<HEAD>

<%
' ********** INSTRUCTIONS FOR QUICK CUSTOMIZATION **********
'
' This form is set up for easy customization. It allows you to modify the
' page logo, the page background, the page title and simple query
' parameters by modifying a few files and form variables. The procedures
' to do this are explained below.
'
'
' *** Modifying the Form Logo:

' The logo for the form is named is2logo.gif. To change the page logo,
simply
' name your logo is2logo.gif and place in the same directory as this form.
If
' your logo is not a GIF file, or you don't want to copy it, change the
following
' line so that the logo variable contains the URL to your logo.

FormLogo = "is2logo.gif"

'
' *** Modifying the Form's background pattern.

' You can use either a background pattern or a background color for your
' form. If you want to use a background pattern, store the file with the
name
' is2bkgnd.gif in the same directory as this file and remove the remark
character
' the single quote character) from the line below. Then put the remark
character on
' the second line below.
'
' If you want to use a different background color than white, simply edit
the
' bgcolor line below, replacing white with your color choice.

' FormBG = "background = " & chr(34) & "is2bkgnd.gif" & chr(34)
FormBG = "bgcolor = " & chr(34) & "#FFFFFF" & chr(34)


' *** Modifying the Form's Title Text.

' The Form's title text is set on the following line.
%>

<TITLE>Document Repository Search</TITLE>

<%

' *** Modifying the Form's Search Scope.
'
' The form will search from the root of your web server's namespace and
below
' (deep from "/" ). To search a subset of your server, for example, maybe
just
' a PressReleases directory, modify the scope variable below to list the
virtual path to
' search. The search will start at the directory you specify and include
all sub-
' directories.

FormScope = "/"

'
' *** Modifying the Number of Returned Query Results.
'
' You can set the number of query results returned on a single page
' using the variable below.

PageSize = 10

'
' *** Setting the Locale.
'
' The following line sets the locale used for queries. In most cases, this
' should match the locale of the server. You can set the locale below.

SiteLocale = "EN-US"

' ********** END QUICK CUSTOMIZATION SECTIONS ***********
%>


<LINK REL=STYLESHEET HREF="is2style.css" TYPE="text/css">

<META NAME="DESCRIPTION" CONTENT="Sample ASP query form for Microsoft
Index Server v2.0">
<META NAME="AUTHOR" CONTENT="Index Server Team">
<META NAME="KEYWORDS" CONTENT="query, content, hit">
<META NAME="SUBJECT" CONTENT="sample form">
<META NAME="MS.CATEGORY" CONTENT="Internet">
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=Windows-1252">

<%
' Set Initial Conditions
NewQuery = FALSE
UseSavedQuery = FALSE
SearchString = ""
CatalogString = ""

strCiQueryFile = Replace(Request.ServerVariables("PATH_INFO"),
"query.asp", "names.idq")
CiQueryFile = strCiQueryFile
QueryForm = Request.ServerVariables("PATH_INFO")

' Did the user press a SUBMIT button to execute the form? If so get the
form variables.
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
SearchString = Request.Form("SearchString")
CatalogString = Request.Form("CatalogString")
FreeText = Request.Form("FreeText")
' NOTE: this will be true only if the button is actually pushed.
if Request.Form("Action") = "Go" then
NewQuery = TRUE
RankBase=1000
end if
end if
if Request.ServerVariables("REQUEST_METHOD") = "GET" then
SearchString = Request.QueryString("qu")
CatalogString = Request.QueryString("CatalogString")
FreeText = Request.QueryString("FreeText")
FormScope = Request.QueryString("sc")
RankBase = Request.QueryString("RankBase")
if Request.QueryString("pg") <> "" then
NextPageNumber = Request.QueryString("pg")
NewQuery = FALSE
UseSavedQuery = TRUE
else
NewQuery = SearchString <> ""
end if
end if
%>

</HEAD>

<BODY <%=FormBG%>>

<TABLE>
<TR><TD><A HREF="http://www.microsoft.com/ntserver/search"
target="_top"><IMG SRC ="<%=FormLogo%>" VALIGN=MIDDLE ALIGN=LEFT
border=0></a></TD></TR>

</TABLE>

<p>

<FORM ACTION="<%=QueryForm%>" METHOD=POST>
<TABLE WIDTH=500>
<TR>
<TD>Enter your query below:</TD>
</TR>
<TR>
<TD>Query: <BR> <INPUT TYPE="TEXT"
NAME="SearchString" SIZE="65" MAXLENGTH="100"
VALUE="<%=SearchString%>"></TD>
<TD><INPUT TYPE="SUBMIT" NAME="Action"
VALUE="Go"></TD>
</TR>
<TR>
<TD>Catalog: <BR> <INPUT TYPE="TEXT"
NAME="CatalogString" SIZE="30" MAXLENGTH="100"
VALUE="<%=CatalogString%>"></TD>
<TD ALIGN="RIGHT"><A
HREF="ixtiphlp.htm">Tips for searching</A></TD>
</TR>
<TR>
</TR>
<TR>
<TD>
<INPUT NAME="FreeText" TYPE=CHECKBOX
<% if
FreeText = "on" then

Response.Write(" CHECKED")
end if
%>>Use <a href="ixtiphlp.htm#FreeTextQueries">Free-Text Query</a>.
</TD>
</TR>
</TABLE>
</FORM>

<BR>

<%
if NewQuery then
set Session("Query") = nothing
set Session("Recordset") = nothing
NextRecordNumber = 1

' Remove any leading and ending quotes from SearchString

SrchStrLen = len(SearchString)

if left(SearchString, 1) = chr(34) then
SrchStrLen = SrchStrLen-1
SearchString = right(SearchString, SrchStrLen)
end if

if right(SearchString, 1) = chr(34) then
SrchStrLen = SrchStrLen-1
SearchString = left(SearchString, SrchStrLen)
end if

if FreeText = "on" then
CompSearch = "$contents " & chr(34) & SearchString & chr(34)
else
CompSearch = SearchString
end if

set Q = Server.CreateObject("ixsso.Query")
set util = Server.CreateObject("ixsso.Util")

Q.Catalog = CatalogString
Q.Query = CompSearch
Q.SortBy = "rank[d]"

'If you have custom properties that you are searching on, thne define them
here.
'Q.DefineColumn "release(DBTYPE_WSTR|DBTYPE_BYREF) =
d5cdd505-2e9c-101b-9397-08002b2cf9ae release"
'Q.DefineColumn "program(DBTYPE_WSTR|DBTYPE_BYREF) =
d5cdd505-2e9c-101b-9397-08002b2cf9ae program"

Q.Columns = "DocTitle, vpath, filename, size, write, characterization,
rank"
Q.MaxRecords = 300


if FormScope <> "/" then
util.AddScopeToQuery Q, FormScope, "deep"
end if

if SiteLocale<>"" then
Q.LocaleID = util.ISOToLocaleID(SiteLocale)
end if

set RS = Q.CreateRecordSet("nonsequential")
RS.PageSize = PageSize
ActiveQuery = TRUE

elseif UseSavedQuery then
if IsObject( Session("Query") ) And IsObject( Session("RecordSet") )
then
set Q = Session("Query")
set RS = Session("RecordSet")

if RS.RecordCount <> -1 and NextPageNumber <> -1 then
RS.AbsolutePage = NextPageNumber
NextRecordNumber = RS.AbsolutePosition
end if

ActiveQuery = TRUE
else
Response.Write "ERROR - No saved query"
end if
end if

if ActiveQuery then
if not RS.EOF then
%>

<p>
<HR WIDTH=80% ALIGN=center SIZE=3>
<p>

<%
LastRecordOnPage = NextRecordNumber + RS.PageSize - 1
CurrentPage = RS.AbsolutePage
if RS.RecordCount <> -1 AND RS.RecordCount < LastRecordOnPage then
LastRecordOnPage = RS.RecordCount
end if

Response.Write "Documents " & NextRecordNumber & " to " &
LastRecordOnPage
if RS.RecordCount <> -1 then
Response.Write " of " & RS.RecordCount
end if
Response.Write " matching the query " & chr(34) & "<I>"
Response.Write SearchString & "</I>" & chr(34) & ".<P>"
%>

<% if Not RS.EOF and NextRecordNumber <= LastRecordOnPage then%>
<table border=0>
<colgroup width=105>
<% end if %>

<% Do While Not RS.EOF and NextRecordNumber <= LastRecordOnPage

' This is the detail portion for Title, Abstract, URL, Size, and
' Modification Date.

' If there is a title, display it, otherwise display the filename.
%>
<p>

<% ' Graphically indicate rank of document with list of stars (*'s).

if NextRecordNumber = 1 then
RankBase=RS("rank")
end if

if RankBase>1000 then
RankBase=1000
elseif RankBase<1 then
RankBase=1
end if

NormRank = RS("rank")/RankBase

if NormRank > 0.80 then
stars = "rankbtn5.gif"
elseif NormRank > 0.60 then
stars = "rankbtn4.gif"
elseif NormRank > 0.40 then
stars = "rankbtn3.gif"
elseif NormRank >.20 then
stars = "rankbtn2.gif"
else stars = "rankbtn1.gif"

end if

%>

<tr class="RecordTitle">
<td align="right" valign=top class="RecordTitle">
<%= NextRecordNumber%>.
</td>
<td><b class="RecordTitle">
<%if VarType(RS("DocTitle")) = 1 or RS("DocTitle") = "" then%>
<a href="<%=RS("vpath")%>" class="RecordTitle"><%= Server.HTMLEncode(
RS("filename") )%></a>
<%else%>
<a href="<%=RS("vpath")%>" class="RecordTitle"><%=
Server.HTMLEncode(RS("DocTitle"))%></a>
<%end if%>
</b></td>
</tr>

<tr>
<td valign=top align=left>
<IMG SRC="<%=stars%>">
<br>
<%
' Construct the URL for hit highlighting
WebHitsQuery = "CiWebHitsFile=" & Server.URLEncode( RS("vpath") )
WebHitsQuery = WebHitsQuery & "&CiRestriction=" & Server.URLEncode(
Q.Query )
WebHitsQuery = WebHitsQuery & "&CiBeginHilite=" & Server.URLEncode(
"<strong class=Hit>" )
WebHitsQuery = WebHitsQuery & "&CiEndHilite=" & Server.URLEncode(
"</strong>" )
WebHitsQuery = WebHitsQuery & "&CiUserParam3=" & QueryForm
WebHitsQuery = WebHitsQuery & "&CiQueryFile=" &
Server.URLEncode(CiQueryFile)
' WebHitsQuery = WebHitsQuery & "&CiLocale=" & Q.LocaleID
%>
<a href="qsumrhit.htw?<%= WebHitsQuery %>"><IMG
src="hilight.gif" align=left alt="Highlight matching terms in document
using Summary mode."> Summary</a>
<br>
<a href="qfullhit.htw?<%= WebHitsQuery %>&CiHiliteType=Full"><IMG
src="hilight.gif" align=left alt="Highlight matching terms in document.">
Full</a>
</td>
<td valign=top>
<%if VarType(RS("characterization")) = 8 and RS("characterization") <>
"" then%>
<b><i>Abstract: </I></b><%= Server.HTMLEncode(RS("characterization"))%>
<%end if%>
<p>
<i class="RecordStats"><a href="<%=RS("vpath")%>" class="RecordStats"
style="color:blue;">http://<%=Request("server_name")%><%=RS("vpath")%></a>
<br><%if RS("size") = "" then%>(size and time
unknown)<%else%>size <%=RS("size")%> bytes - <%=RS("write")%> GMT<%end
if%></i>
</td>
</tr>
<tr>
</tr>

<%
RS.MoveNext
NextRecordNumber = NextRecordNumber+1
Loop
%>

</table>

<P><BR>

<%
else ' NOT RS.EOF
if NextRecordNumber = 1 then
Response.Write "No documents matched the query<P>"
else
Response.Write "No more documents in the query<P>"
end if

end if ' NOT RS.EOF


if NOT Q.OutOfDate then
' If the index is current, display the fact %>
<P>
<I><B>The index is up to date.</B></I><BR>
<%end if


if Q.QueryIncomplete then
' If the query was not executed because it needed to enumerate to
' resolve the query instead of using the index, but AllowEnumeration
' was FALSE, let the user know %>

<P>
<I><B>The query is too expensive to complete.</B></I><BR>
<%end if


if Q.QueryTimedOut then
' If the query took too long to execute (for example, if too much work
' was required to resolve the query), let the user know %>
<P>
<I><B>The query took too long to complete.</B></I><BR>
<%end if%>


<TABLE>

<%
' This is the "previous" button.
' This retrieves the previous page of documents for the query.
%>

<%SaveQuery = FALSE%>
<%if CurrentPage > 1 and RS.RecordCount <> -1 then %>
<td align=left>
<form action="<%=QueryForm%>" method="get">
<INPUT TYPE="HIDDEN" NAME="qu" VALUE="<%=SearchString%>">
<INPUT TYPE="HIDDEN" NAME="CatalogString"
VALUE="<%=CatalogString%>">
<INPUT TYPE="HIDDEN" NAME="FreeText"
VALUE="<%=FreeText%>">
<INPUT TYPE="HIDDEN" NAME="sc" VALUE="<%=FormScope%>">
<INPUT TYPE="HIDDEN" name="pg" VALUE="<%=CurrentPage-1%>" >
<INPUT TYPE="HIDDEN" NAME = "RankBase" VALUE="<%=RankBase%>">
<INPUT TYPE="HIDDEN" NAME = "CiQueryFile" VALUE="<%=CiQueryFile%>">
<input type="submit" value="Previous <%=RS.PageSize%>
documents">
</form>
</td>
<%SaveQuery = TRUE%>
<%end if%>


<%
' This is the "next" button for unsorted queries.
' This retrieves the next page of documents for the query.

if Not RS.EOF then%>
<td align=right>
<form action="<%=QueryForm%>" method="get">
<INPUT TYPE="HIDDEN" NAME="qu" VALUE="<%=SearchString%>">
<INPUT TYPE="HIDDEN" NAME="CatalogString"
VALUE="<%=CatalogString%>">
<INPUT TYPE="HIDDEN" NAME="FreeText"
VALUE="<%=FreeText%>">
<INPUT TYPE="HIDDEN" NAME="sc" VALUE="<%=FormScope%>">
<INPUT TYPE="HIDDEN" NAME = "RankBase" VALUE="<%=RankBase%>">
<INPUT TYPE="HIDDEN" NAME = "CiQueryFile"
VALUE="<%=CiQueryFile%>">
<INPUT TYPE="HIDDEN" name="pg" VALUE="<%=CurrentPage+1%>">

<% NextString = "Next "
if RS.RecordCount <> -1 then
NextSet = (RS.RecordCount - NextRecordNumber) + 1
if NextSet > RS.PageSize then
NextSet = RS.PageSize
end if
NextString = NextString & NextSet & " documents"
else
NextString = NextString & " page of documents"
end if
%>
<input type="submit" value="<%=NextString%>">
</form>
</td>
<%SaveQuery = TRUE%>
<%end if%>

</TABLE>

<% ' Display the page number %>

Page <%=CurrentPage%>
<%if RS.PageCount <> -1 then
Response.Write " of " & RS.PageCount
end if %>

<%
' If either of the previous or back buttons were displayed, save the
query
' and the recordset in session variables.
if SaveQuery then
set Session("Query") = Q
set Session("RecordSet") = RS
else
RS.close
Set RS = Nothing
Set Q = Nothing
set Session("Query") = Nothing
set Session("RecordSet") = Nothing
end if
%>
<% end if %>

</BODY>
</HTML>


Does this answer your question? Thank you for using Microsoft Newsgroups!

Andrés Naranjo [MSFT]
Microsoft DS Communities Team

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com