1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Exception from backend while creating search index

Exception from backend while creating search index

7 posts, 1 answered
  1. Alessio S.
    Alessio S. avatar
    37 posts
    Registered:
    31 May 2010
    08 Jul 2010
    Link to this post
    Hi,
    I tried to create a search index for a custom News provider (it just has a couple metafields in addition to the basic ones) and when I clicked the button to save the index I got a System.FormatException: The string was not recognized as a valid DateTime.
    The big problem is now I get the same exception again every time I click the "Administration" tab in the backend, so I'm unable to access any page under that tab and I cannot check whether the index had been actually saved or not. The stacktrace below is from this situation but it's identical to the one I got when clicking the "Save changes" button.
    Sitefinity version is 3.7.2096 and I'm using the compiled language packs (the backend UI is set to Italian).

    System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +2845862 System.DateTime.Parse(String s) +25 Telerik.Cms.Web.UI.DateTimeLiteral.set_Text(String value) +88 Telerik.Search.WebControls.Admin.ControlPanel.Indexes_ItemDataBound(Object sender, RepeaterItemEventArgs e) +877 System.Web.UI.WebControls.Repeater.OnItemDataBound(RepeaterItemEventArgs e) +108 System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) +136 System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +443 System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +51 System.Web.UI.WebControls.Repeater.DataBind() +75 Telerik.Search.WebControls.Admin.ControlPanel.LoadMainScreenTemplate() +479 Telerik.Search.WebControls.Admin.ControlPanel.CreateChildControls() +90 System.Web.UI.Control.EnsureChildControls() +87 System.Web.UI.Control.PreRenderRecursiveInternal() +44 System.Web.UI.Control.AddedControl(Control control, Int32 index) +8682853 System.Web.UI.ControlCollection.Add(Control child) +80 Telerik.Cms.Web.UI.ServiceList.CreateChildControls() +1863 System.Web.UI.Control.EnsureChildControls() +87 System.Web.UI.Control.PreRenderRecursiveInternal() +44 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

    Thank you for the excellent support,
    Alessio
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    08 Jul 2010
    Link to this post
    Hello Alessio S.,

    Open App_Data/Search/[name of your index] and remove the whole directory and its files from there. Then open your database and remove all records related to your index from

    • sf_Search_ClientSettings
    • sf_Search_IndexignClient
    • sf_Search_IndexignService
    The problem is that you are passing invalid data time string in one of your custom metakeys.
    You can take a look at this post for further reference - Blog Date formatting
    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Alessio S.
    Alessio S. avatar
    37 posts
    Registered:
    31 May 2010
    08 Jul 2010
    Link to this post
    Thank you, that fixed the backed but I'm not using DateTime data in my metafields, there are only two ShortText fields (there are the Pubblication_Date and Expiration_date but they are copied from the standard News sections in web.config). I tried creating a search for the default News provider and I get the same error. In fact I get the same error if I try to create any index with any kind of Source.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    08 Jul 2010
    Link to this post
    Hello Alessio S.,

    Looking at the stack track the error comes when the Search Control Panel is trying to bind a repeater control inside  "~/Sitefinity/Admin/ControlTemplates/Search/ControlPanelMain.ascx". In this template there is a control of type DateTimeLiteral with ID="date". Could you make sure that you have not change this template and especially the control of type DateTimeLiteral  and its properties like DateFormatString. Below is the default template that you can use for comparison. The error is thrown, because the value returned by DateTimeLiteral   is not recognized as a valid format by .NET

    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Cms.Web.UI" TagPrefix="sfWeb" %>
     <div class="ToolsAll"><asp:LinkButton ID="addServiceButton" runat="server" Text="<%$ Resources:AddaNewSearchIndex %>" class="CmsButLeft new"></asp:LinkButton>
     </div>
     <div class="workArea">
     <div class="mainForm">
     <h2 class="gridTitle"><asp:Literal ID="Literal8" runat="server" Text="<%$ Resources: IndexesMainHeader %>"></asp:Literal></h2>
    <asp:Repeater ID="indexes" runat="server">
        <HeaderTemplate>
         
        </HeaderTemplate>
        <ItemTemplate>
             
            <div class="set">
            <div class="setIn">
                <div class="indexDetails">
                        <span><asp:Literal ID="Literal8" runat="server" Text="<%$ Resources: IndexesItemHeader %>"></asp:Literal></span>
                        <h3>
                            <%#DataBinder.Eval(Container.DataItem, "Name")%>
                        </h3>
                         
                            <p><%#DataBinder.Eval(Container.DataItem, "Description")%></p>
                        
                </div>
                <div class="values">
                        <asp:Repeater ID="clientsRepeater" runat="server">
                            <HeaderTemplate>
                                <h4><asp:Literal runat="server" Text="<%$ Resources: WhatToIndex %>"></asp:Literal></h4>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <h5>
                                    <%#DataBinder.Eval(Container.DataItem, "Name")%>
                                </h5>
                                <asp:PlaceHolder ID="viewSettingsControl" runat="Server"></asp:PlaceHolder>
                            </ItemTemplate>
                        </asp:Repeater>
                    </div>
                    <div class="stat">
                        <h4><asp:Literal ID="Literal4" runat="server" Text="<%$ Resources:IndexStatus %>"></asp:Literal></h4><ul>
                            <li><asp:Literal ID="Literal1" runat="server" Text="<%$ Resources:IndexedWords %>"></asp:Literal>: <strong><asp:Literal ID="words" runat="server"></asp:Literal></strong></li>
                            <li><asp:Literal ID="Literal2" runat="server" Text="<%$ Resources:SpideredPages %>"></asp:Literal>: <strong><asp:Literal ID="pages" runat="server"></asp:Literal></strong></li>
                            <li><asp:Literal ID="Literal3" runat="server" Text="<%$ Resources:LastIndexingDate %>"></asp:Literal>: <strong><sfWeb:DateTimeLiteral runat="server" ID="date" DateFormatString="dd MMM yyyy, hh:mm" /></strong></li>
                        </ul>
                    </div>
                    <div class="foot">
                         
                        <asp:LinkButton ID="editButton" runat="server"><asp:Literal ID="Literal6" runat="server" Text="<%$ Resources:EditThisIndex %>"></asp:Literal></asp:LinkButton> |
                        <asp:LinkButton ID="deleteButton" OnClientClick="return confirm('Are you sure you want to delete this index?')" runat="server"><asp:Literal ID="Literal7" runat="server" Text="<%$ Resources:Delete %>"></asp:Literal></asp:LinkButton> |
                        <asp:LinkButton ID="indexButton" OnClientClick="indexingStart();" runat="server">
                        <asp:Literal ID="Literal5" runat="server" Text="<%$ Resources:StartIndexing %>"></asp:Literal></asp:LinkButton>
                    </div>
           </div>
           </div>
           <div class="bottom"><div><!-- --></div></div>
        </ItemTemplate>
        <FooterTemplate>
         
        </FooterTemplate>
    </asp:Repeater>
     
    <asp:PlaceHolder runat="server" ID="emptyWindow">
        <div id="empty">
            <h2 class="gridTitle">
                <asp:Literal ID="Literal1" runat="server" Text="<%$Resources:NoIndexes %>"></asp:Literal>
            </h2>
            <p>
                <asp:LinkButton ID="createNewEmpty" runat="server" cssClass="mainLink" ToolTip="<%$Resources:CreateYourFirstIndexTooltip %>">
                    <strong><asp:Literal ID="Literal2" runat="server" Text="<%$Resources:CreateYourFirstIndex %>"></asp:Literal></strong>
                </asp:LinkButton>
                <!--
                <br />
                <asp:Literal ID="Literal3" runat="server" Text="<%$Resources:Or %>"></asp:Literal>, 
                <a href="#" target="_blank" title="Opens in a new browser window">
                    <asp:Literal ID="Literal4" runat="server" Text="<%$Resources:CheckListsFAQ %>"></asp:Literal>
                </a>
                -->
            </p>      
        </div>
    </asp:PlaceHolder>
     
    </div>
    <div class="info" id="divFaq" runat="server">
    <div class="infoBottom">
        <h3><asp:Literal ID="Literal10" runat="server" Text="<%$Resources:SearchIndexFAQTitle %>"></asp:Literal></h3>
        <asp:Literal ID="Literal9" runat="server" Text="<%$Resources:SearchIndexFAQText %>"></asp:Literal>
        <p class="hideAllFAQs">
            <a href="javascript:void(0)" onclick="javascript:Personalization.hideFaqSection('<%= divFaq.ClientID %>')">Hide FAQs everywhere</a>
        </p>
        </div>
    </div>
    <div class="clear"><!-- --></div>
    <div id="searchIndexingInProcess">
     
        <div class="searchIndexingLoading"><asp:Image ID="indexImage" runat="server" ImageUrl="~/Sitefinity/Admin/Themes/Default/Images/loader.gif" /><p>Indexing...</p></div>
     
        <div class="searchIndexingBackground"></div>
     
    </div>
    </div>




    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Alessio S.
    Alessio S. avatar
    37 posts
    Registered:
    31 May 2010
    09 Jul 2010
    Link to this post
    I haven't changed that file, the tag seems identical:

    <sfWeb:DateTimeLiteral runat="server" ID="date" DateFormatString="dd MMM yyyy, hh:mm" />

    Could it be related to localization? I have these options set in web.config:

    <globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="it-IT" uiCulture="it-IT" />
     
    ...
     
    <localization defaultProvider="Sitefinity" persistenceMode="None" defaultCulture="it" cultures="en, it">
                <providers>
                    <clear/>
                    <add name="Sitefinity" type="Telerik.Localization.Data.DefaultProvider, Telerik.Localization.Data" connectionStringName="DefaultConnection"/>
                </providers>
            </localization>

  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    09 Jul 2010
    Link to this post
    Hi Alessio S.,

    Try removing the globalization element and test the behavior of the ControlPanelMain.ascx.

    Most probably the globalization element that you use converts the date to an incorrect format.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  7. Alessio S.
    Alessio S. avatar
    37 posts
    Registered:
    31 May 2010
    09 Jul 2010
    Link to this post
    Deleting the section doesn't seem to get rid of the error. I've replaced the DateTimeLiteral with a normal Literal and the ControlPanelMain loads correctly, and the literal displays the date formatted like this (which seems to be the usual default format):
    09/07/2010 16.39
    Since the admin page works and the search works too I have no problem leaving things this way, though I have no idea what was wrong with the data.
Register for webinar
7 posts, 1 answered