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

Forums / General Discussions / Search Error

Search Error

7 posts, 0 answered
  1. Pik Lee
    Pik Lee avatar
    142 posts
    Registered:
    13 Aug 2012
    22 Jun 2010
    Link to this post
    I received the following error message, when I do a search.

    Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

    Any idea why?

    Thanks,
    Pik
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    22 Jun 2010
    Link to this post
    Hello Pik Lee,

    Is there any stack trace thrown or some more details in the log file under App_Data folder?

    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
  3. Greg
    Greg avatar
    82 posts
    Registered:
    08 Aug 2012
    22 Jun 2010
    Link to this post
    Hi Pik -

    I've seen this error, I believe, when I've fat fingered or deleted a character out of one of the image or document selection boxes (looks like Library[xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx].) I'd check to make sure that any images or documents you are selecting/linking to are correct.

    Greg
  4. Pik Lee
    Pik Lee avatar
    142 posts
    Registered:
    13 Aug 2012
    23 Jun 2010
    Link to this post
    Thanks for the reply. It looks like my code below did not get the ID from the snippet. Am I missing something here? Thank you in advance for your assistance.

    Here is part of custom search code.

    . . .
    foreach (ResultItem item in dataSource)
     {
                      string value = item.Snippet;
                      string ID = value.Substring(0, 36);
                      Guid ItemID = new Guid(ID);

                      CmsManager cmsManager = new CmsManager();
                       ICmsPage page = (ICmsPage)cmsManager.GetPage(ItemID);
                       PagePermission perm = new PagePermission(page);
    .  .  .

    Thanks,
    Pik
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    23 Jun 2010
    Link to this post
    Hello Pik Lee,

    Most probably the value that you substring is not a valid guid. Then you use this value to create a new guid and an error is thrown.  If the problem occurs only during the indexing you can wrap this logic inside the if check below or just add Guid validator before trying to create a new guid.

    if (!CmsContext.IsRequestCrawler(this.Context))
      {
     
      }


    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
  6. Pik Lee
    Pik Lee avatar
    142 posts
    Registered:
    13 Aug 2012
    23 Jun 2010
    Link to this post
    Thanks for the info.

    For some reason, when I search for some of the word like "Productivity", it throw an error like below.  But have not problem to search for "Productivity and Costs". Any idea why?  Thanks, ~ Pik
    Index and length must refer to a location within the string.<br>Parameter name: length

    Index and length must refer to a location within the string.
    Parameter name: length

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
    Parameter name: length

    Source Error:

    Line 98: 
    Line 99:                                     string value = item.Snippet;
    Line 100:                                    string ID = value.Substring(0, 36);
    Line 101:
    Line 102:                                    Guid ItemID = new Guid(ID);


  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    23 Jun 2010
    Link to this post
    Hi Pik Lee,

    Substring takes a start index and a length, but not an end index which seems to be less than 36 in some of the cases. I suggest that you should add some if loops to check the ResultItem.Snippet. The code you use have been supplied to the community for demonstration purpusase and you should add some additional logic to escape such issues. For instance you get the same problem with you substring 36 symbols which are not even a guid. So, you should better check the string length and validate the returned value whether it is valid guid.

    All the best,
    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
Register for webinar
7 posts, 0 answered