Robert

Robert

  • NA
  • 22
  • 25.9k

Indexing Service Search problem

Dec 10 2008 10:48 AM

I am trying to use the Indexing Service to search for content from a folder on my web site called "products".

Here are the details...

In the "<asp:SqlDataSource" command which begins on line 37 in Search99.aspx, the "SelectCommand" contains a Scope parameter.  If I leave the Scope as "Scope()" the program works, however it searches the entire website.

If I add "' DEEP TRAVERSAL OF ("/products") '" to the Scope() then the program fails with message

 " Parser Error Message: The server tag is not well formed."

Is this a syntax error or is there something I'm missing?

Also can we search more than one directory in "Scope parameter"?

Any help would be appreciated ...

 

Rob

 

search99.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Search99.aspx.cs" Inherits="Search9" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<script src="/scripts/dateLastMod.js" type="text/javascript"></script>
<link href="/App_Themes/Default/default.css" rel="stylesheet" type="text/css" />
<link href="/App_Themes/Default/tabs.css" rel="stylesheet" type="text/css" />
<title>Home</title>
</head>
<body>
<form id="form1" runat="server">
<a name="top"></a>
<div id="main">
    <div id="netid" style: align="center"><img src="/graphics/network.png" /></div>
    <div id="header" style: align="center"><img src="/graphics/banner.png" /></div>
    <div id="topnav">
     <ul class="tab">
     <li class="selected"><a href="/default.aspx"><img src="/graphics/home.png" alt="Home" />Home</a></li>
     <li><a href="/Intel/default.aspx"><img src="/graphics/intel.png" alt="Intelligence" />Int</a></li>
     <li><a href="/OPs/default.aspx"><img src="/graphics/ops.png" alt="Operations" />OPs</a></li>
     <li><a href="/Tools/default.aspx"><img src="/graphics/tools.png" alt="Tools" />Tools</a></li>
     <li><a href="/Security/default.aspx"><img src="/graphics/security.png" alt="Security" />Security</a></li>
     <li><a href="/Admin/default.aspx"><img src="/graphics/admin.png" alt="Administration" />Admin</a></li>
     <li><a href="/Search/default.aspx"><img src="/graphics/search.png" alt="Search" />Search</a></li>
     <li><a href="/GenInfo/default.aspx"><img src="/graphics/info.png" alt="General Info" />General Info</a></li>
     </ul>
 </div>
    <div id="breadCrumbs" class="breadCrumbs"><a href="/default.aspx">CDI Home</a></div>
    <div id="clientNav">&nbsp;</div>
    <div id="content" class="content">
    
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Provider=MSIDXS;Data Source=web"         
            SelectCommand="Select DocTitle, path, vpath, filename, write, characterization, ilcountryname, ilagency, ildoctype, ildoccategory, ilkeyword, ilsummary, idcAttachmentSize FROM SCOPE(' DEEP TRAVERSAL OF ("/products") ') WHERE CONTAINS(ildoctype, 'BRIEF') AND Path NOT LIKE '%search_excluded%' order by rank desc"
            ProviderName="System.Data.OleDb">
        </asp:SqlDataSource>
       
        <asp:ListView ID="productsList" runat="server" DataSourceID="SqlDataSource1">
            <LayoutTemplate>
                <ul>
                    <asp:PlaceHolder ID="itemPlaceHolder" runat="server" />
                </ul>
            </LayoutTemplate>
            <ItemTemplate>
               
                <% int cnt = 0; %>
                <% cnt += 1; %>
               
                <a href='<%# DataBinder.Eval(Container.DataItem, "vpath") %>'><%# DataBinder.Eval(Container.DataItem, "DocTitle") %></a> <br />

                    <asp:Label ID="Label2" runat="server" Text="Agency: " class="searchText" />
       <%# DataBinder.Eval(Container.DataItem, "ilagency")%> <br />
       
                    <asp:Label ID="Label3" runat="server" Text="Countries Discussed: " class="searchText" />
       <%# DataBinder.Eval(Container.DataItem, "ilcountryname")%> <br />
       
                    <asp:Label ID="Label4" runat="server" Text="Summary: " class="searchText" />
       <%# DataBinder.Eval(Container.DataItem, "ilsummary")%> <br /><br />
       
                    <asp:Label ID="Label5" runat="server" Text="Time and Date Posted: " class="searchText" />
       <%# DataBinder.Eval(Container.DataItem, "write")%> <br />
       
                    <asp:Label ID="Label6" runat="server" Text="File Size: " class="searchText" />
       <%# DataBinder.Eval(Container.DataItem, "idcAttachmentSize")%>
                    <asp:Label ID="Label7" runat="server" Text=" Kb" class="searchText" /> <br /><hr /><br />

            </ItemTemplate>
            <EmptyDataTemplate>
                <h4>
                    Sorry - no products found.
                </h4>
            </EmptyDataTemplate>
        </asp:ListView>
           
        <asp:DataPager PageSize="2" runat="server" PagedControlID="productsList">
            <Fields>
                <asp:NextPreviousPagerField ButtonType="Button" FirstPageText="First Page"
                 LastPageText="Last Page" NextPageText="Next Page" PreviousPageText="Previous Page" ShowFirstPageButton="True" ShowLastPageButton="True" />
            </Fields>
        </asp:DataPager>
        <br /><br />
        <asp:DataPager ID="DataPager1" PageSize="2" runat="server" PagedControlID="productsList">
            <Fields>
                <asp:NumericPagerField ButtonType="Button"
                    NextPageText="Next Page" PreviousPageText="Previous Page" />               
            </Fields>
        </asp:DataPager>

    </div>
    <div id="footer" class="footer">   
        <div id="footLeft">
            <div>
                <script language="JavaScript">document.write("Publication Date:&nbsp; " + date_lastmodified());</script>
            </div>
        </div>
        <div id="footMiddle">
            <div><a href="#top">Top</a></div>
        </div>
        <div id="footRight">
            <div><a href="#">Important Notices </a></div>
        </div>
    </div>       
</div>
</form>
</body>
</html>

search99.aspx.cs

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class Search9 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
}


Answers (1)