Sitefinity ASP.NET CMS - Content Management System

Support Forum Thread

Home >  Support >  Forums home > Sitefinity 3.x > Bugs & Issues > Unable to retrieve search results

Reply
Kiran Kakanur, 7/17/2008 3:13:32 PM

Hi,

We have a web site that has the following folder hierarchy:


home
home\locations\dtc 
home\locations\denver


The corresponding web site URLs for the above folders are:

http://www.homepage.com
http://www.homepage.com/locations/dtc
http://www.homepage.com/locations/denver

The "home" folder hosts pages for the site at the "home" level.

"dtc" is the name of a location, and therefore the "dtc" folder hosts pages/content for the "dtc" location.

"denver" is the name of a location, and therefore the "dtc" folder hosts
pages/content for the "dtc" location.

I want to enable Search functionality at all 3 levels listed above.

So I created 3 Search Indexes under the SiteFinity "Administration" module.

The Search Indexes and their settings are listed below:


EntireSite - this is for the "home" site

Settings for "EntireSite" search index are:

PageIndex
Auto index: False
Index non-public pages: False
Starting node URL: All Pages


dtc - this is search index for the "dtc" site

PageIndex
Auto index: False
Index non-public pages: False
Starting node URL: ~/locations/dtc.aspx


denver - this is search index for the "denver" site

PageIndex
Auto index: False
Index non-public pages: False
Starting node URL: ~/locations/denver.aspx

And when I clicked on "Start Indexing" it is able to index the content, because I see something like this in the "Index Status" column. So the Search is working:

Index status

  • Indexed words: 66
  • Indexed pages: 78
  • Last indexing date: 17 Jul 2008, 02:50


And in the code-behind in the MasterPage that is referenced by the web pages, I have the following code:

<%@ Master Language="C#" %> 
<%@ Register Src="../Controls/TopNav.ascx" TagName="TopNav" TagPrefix="uc1" %> 
<%@ Register Src="../Controls/Footer.ascx" TagName="Footer" TagPrefix="uc2" %> 
<%@ Register Src="../Controls/Footer2.ascx" TagName="Footer2" TagPrefix="uc3" %> 
<%@ Register Src="../Controls/LeftNav.ascx" TagName="LeftNav" TagPrefix="uc4" %> 
<%@ Register tagprefix="cc" namespace="Telerik.Search.WebControls" assembly="Telerik.Search" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<script runat="server">  
    protected void Page_Load(object sender, EventArgs e)  
    {  
        string CurClub = "";  
          
        if(SiteMap.CurrentNode.Url.Contains("/locations/"))  
        {  
            CurClub = SiteMap.CurrentNode.Url.ToString();  
            CurClubCurClub = CurClub.Replace("~/locations", "");  
            CurClubCurClub = CurClub.Remove(0, 1);  
            CurClubCurClub = CurClub.Replace(".aspx", "");  
            CurClubCurClub = CurClub.Substring(0, CurClub.IndexOf("/"));  
        }  
 
 
        if(CurClub == "dtc")  
        {  
            SearchBox1.EnableViewState = false;  
            SearchBox1.IndexCatalogue = "dtc";  
            SearchBox1.ResultUrl = "/locations/dtc/results.aspx";  
        }  
        else if(CurClub == "denver")  
        {  
            SearchBox1.EnableViewState = false;  
            SearchBox1.IndexCatalogue = "denver";  
            SearchBox1.ResultUrl = "/locations/denver/results.aspx";  
        }  
        else  
        {  
            SearchBox1.EnableViewState = false;  
            SearchBox1.IndexCatalogue = "EntireSite";             
            SearchBox1.ResultUrl = "~/results.aspx";              
 
        }  
 
    }  
 
</script> 
 
 

But when I attempt to search for content in the web pages, I get 0 results. I get no results at the "home"  or the "dtc" or the "denver" levels. It comes back with 0 results everywhere.

I am seeing the following search index related errors in the SiteFinity.log. Shown below is the error that I am getting for the "dtc" site. I also see the same type of error for the "denver" site.

7/17/2008 10:25:08 AM [EXCEPTION]
************************************************************************************
ID: 2e294c53-141c-4449-8659-5ddc44171337; Code: 100103; Occurrence: 6; Sequence: 27
------------------------------------------------------------------------------------

Application information:
 Machine name: WBW23WELBDG001
 OS Version: Microsoft Windows NT 5.2.3790 Service Pack 2
 Product Version: 3.2.1598.1
 Application Path: C:\WEBSITES\ColoradoAthleticClub\
 Debug: True

Process information:
 Process ID: 6392
 Process Name: w3wp

Request information:
 Request URL: /Sitefinity/Admin/CmsAdmin/Services.aspx
 Rewrite URL: http://cac.revereserviceportal.com/Sitefinity/Admin/CmsAdmin/Services.aspx
 Url Referrer: http://cac.revereserviceportal.com/Sitefinity/Admin/CmsAdmin/Services.aspx
 Is Authenticated: True
 Authentication Type: Forms
 User: admin
 User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648)
 User Address: 192.168.50.63

Variables:
 AspSession: System.Web.SessionState.HttpSessionState
 SF_Crawler: True
 cmscurrcult:
 cmspageid: f7581d54-cd6f-4f18-acbc-926e4ab2e83d
 RadControlRandomNumber: 0
 AspSessionIDManagerInitializeRequestCalled: True

- L0 -------------------------------------------------------------------------------

Exception Type: Telerik.Framework.Search.IndexExcepton

Message: An error has occurred while indexing the following document:  "~/locations/DTC/results.aspx". Please see inner exception for more details.

Source:

Stack Trace:

------------------------------------------------------------------------------------
- L1 -------------------------------------------------------------------------------

Exception Type: System.Web.HttpException

Message: Error executing child request for /sitefinity/cmsentrypoint.aspx.

Source: System.Web

Stack Trace:
   at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)
   at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm)
   at Telerik.Cms.Search.PageIndexerInfo.GetInternalPageData()
------------------------------------------------------------------------------------
- L2 -------------------------------------------------------------------------------

Exception Type: System.Web.HttpUnhandledException

Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.

Source: System.Web

Stack Trace:
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at ASP.sitefinity_cmsentrypoint_aspx.ProcessRequest(HttpContext context)
   at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)
------------------------------------------------------------------------------------
- L3 -------------------------------------------------------------------------------

Exception Type: System.NullReferenceException

Message: Object reference not set to an instance of an object.

Source: App_Web_5yiwwcro

Stack Trace:
   at ASP.app_master_contentpage_master.Page_PreRender(Object sender, EventArgs e) in c:\WEBSITES\ColoradoAthleticClub\App_Master\ContentPage.master:line 14
   at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
   at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
   at System.Web.UI.Control.OnPreRender(EventArgs e)
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
------------------------------------------------------------------------------------

What am I missing?

Also, it appears that the Search is only able to index content up to a certain level. Is there a way to specify the number of levels that must be indexed?

Thanks in advance for your help.

Best regards,
Kiran

 


 


Reply
Kiran Kakanur, 7/17/2008 10:56:06 PM
I did not include the aspx code earlier. Here is the aspx code (including the code that renders the SearchBox control):

<html xmlns="http://www.w3.org/1999/xhtml">  
<head id="Head1" runat="server">  
    <title>Untitled Page</title> 
    <script language="JavaScript" type="text/javascript" src="/scripts/base.js"></script> 
     <style type="text/css">  
      
        ul {           
            margin:0px;  
         list-style-image: none;  
         list-style-type: none;  
        }  
          
         li {           
            margin:0px;  
            }  
    </style> 
</head> 
<body> 
    <form id="form1" runat="server">  
    <div id="backgroundeffect">  
        <div id="container">  
            <div id="header">  
                <div id="searchbox">  
                    <div class="searchtable">  
                        <cc:SearchBox id="SearchBox1" runat="server"></cc:SearchBox>                                  
                    </div> 
                </div> 
                <!-- TOPNAV --> 
                <uc1:TopNav ID="TopNav1" runat="server" /> 
            </div> 
            <div id="middle">  
                <table border="0" cellpadding="0" cellspacing="0" id="contenttablecourt">  
                    <tr> 
                        <td class="leftcol"><asp:ContentPlaceHolder ID="plcLeftImage" runat="server"></asp:ContentPlaceHolder><uc4:LeftNav ID="LeftNav1" runat="server" /></td>  
                        <td class="middlecol"><div class="detailcontent"><asp:ContentPlaceHolder ID="pclBody" runat="server"></asp:ContentPlaceHolder></div></td> 
                        <td height="100%" class="rightcol"><asp:ContentPlaceHolder ID="pclRightImage" runat="server"></asp:ContentPlaceHolder></td>  
                    </tr> 
                </table> 
            </div> 
            <!-- FOOTER --> 
            <uc2:Footer ID="Footer1" runat="server" /> 
        </div> 
    </div> 
        <!-- FOOTER2 --> 
        <uc3:Footer2 ID="Footer2" runat="server" /> 
        <!--[if lte IE 6]> 
<script type="text/javascript" src="scripts/supersleight-min.js"></script> 
<![endif]--> 
    </form> 
</body> 
</html> 
 

The content is being Indexed but we are unable to retrieve any results when searching for content. It appears that only some content is being Indexed.

Thanks in advance for your help.

Best regards,
Kiran

 

 


Reply
, 7/18/2008 5:23:55 AM
Hi Kiran Kakanur,

Did you notice the L3 lines in your exception, in particular this line:
"..ASP.app_master_contentpage_master.Page_PreRender(Object sender, EventArgs e) in c:\WEBSITES\ColoradoAthleticClub\App_Master\ContentPage.master:line 14..".
The Page_Load event in your Master page is probably the reason for the indexing to throw an exception. This happens because the SiteMap.CurrentNode is null at the time the page is being indexed.

Try to put the following condition (line 6) inside Page_Load:

1 <script runat="server">     
2     protected void Page_Load(object sender, EventArgs e)     
3     {     
4         string CurClub = "";  
5  
6          if(!Telerik.CmsContext.IsCrawlerRequest)  
7          {           
8            
9          //Your code here  
10            
11          }   
12     }    
13 </script>    
14  

So that this will not be applied during indexing as it is not needed for the contents to be indexed.

Let me know the result.

Sincerely yours,
Nikola
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center

Reply
Kiran Kakanur, 7/18/2008 9:10:23 AM
Hi Nikola,

That was it. You are the BEST! Thank you very much for your prompt response.

Cheers,
Kiran