Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Craig Cronin 304 posts 503 karma points
    Jul 03, 2015 @ 15:14
    Craig Cronin
    0

    Examine issue thats driving me mad!!!!

    I have a simple examine razor search and all was working on my dev pc but when I moved the site to the live environment it generates a razor script error on search

    I've deleted the umbraco cache, deleted the search indexes but still no joy.

    The thing that's making me mad, is that I'm breaking the query down, please see below

    var term = Request["search"];
    
    var searcher = ExamineManager.Instance.SearchProviderCollection["CorporateSearcher"];
    var searchCriteria = searcher.CreateSearchCriteria();
    
    
    var query = searchCriteria.Field("nodeName", term)
        .Or().Field("bodyText", term)
        .Or().Field("title", term)
        .Or().Field("summary", term)
        .Or().Field("pageName", term)
        .Compile();
    var results = searcher.Search(query).OrderBy(o => o.Score);
    

    This will run fine, but I'll add a small piece of Html in and it suddenly stops. Once I remove the newly added code the whole thing generates an error.

    I'd driving me crazy because I have a go live date. Any help would really be appreciated.

  • Dallas 132 posts 404 karma points
    Jul 03, 2015 @ 16:31
    Dallas
    100

    hi Craig

    Can you provide the error message that you are getting? Is it an Examine error or a Razor error?

    Dallas

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Jul 03, 2015 @ 16:42
    Ismail Mayat
    0

    Craig,

    Not a fix but observation no need to orderyby score as your results are already ordered by lucene by score.

    After moving to live I take it you rebuilt indexes?

    Regards

    Ismail

  • Craig Cronin 304 posts 503 karma points
    Jul 03, 2015 @ 18:31
    Craig Cronin
    0

    Hi Dallas,

    I'm not in work now until monday so don't have it to hand BUT!!!

    Its the generic razor error message I get. I have just deployed to the staging server and then will be using courier to push the content live.

    I have visual studio remote debugging tools going so that I can debug locally but whats strange is that it just jumps over the @Umbraco.RenderMarc("") when there is a problem.

    I'd expect it to go into the macro and then probably error on a line. I've tried to break it down so strip everything out. I then build it back up slowly adding a line at a time.

    It gets to a point that I put a basic html/razor syntax in and it breaks again, even when I remove the line its still broken.

    I've been using Umbraco now for about 5 years and its got to be something silly happening but I just can't put my finger on it.

  • Craig Cronin 304 posts 503 karma points
    Jul 03, 2015 @ 18:35
    Craig Cronin
    0

    Hi Ismail,

    I was really hoping you would see the post :) Since copying the site over to the staging server I've:

    • Deleted umbraco.config.
    • Deleted the examine indexes
    • Restarted the website
    • Published the whole site again

    It just doesn't make sense? What freaks me out it that I manage to have something that brings back the titles.

    I then add an additional line e.g

    result["BodyText"]

    or something to bring back further fields and the whole things stops working.

    I then go and take this line back out but it still doesn't work

  • Craig Cronin 304 posts 503 karma points
    Jul 06, 2015 @ 10:39
    Craig Cronin
    0

    Hi Dallas/Ismail,

    I created a small screenr video that shows my issue.

    https://www.screenr.com/RdeN

    The video shows the dev computer (mine windows 8) and the staging server (internal 2012)

    I've just copied the whole directory from my computer to the staging server, including the web.config, so they are exact the same installs.

    1. I show the search results on dev
    2. Then i show the search error on staging.
    3. I remove some of the examine code and run the search on both.
    4. This has now removed the error.
    5. I then add in part of the code which should not be causing this issue.

    I'm completely stuck with this and thinking about throwing my computer through the window!!!!

  • Dallas 132 posts 404 karma points
    Jul 06, 2015 @ 11:26
    Dallas
    0

    Craig

    When the macro error occurs Umbraco will log the error in \app_data\logs\UmbracoTracelog.txt. The error message should be logged and this will give you a better idea of what is causing the error on staging.

    You can also change the way that macro errors are handled. The UmbracoSettings.config file has an setting named macroErrors. By default Umbraco will use the inline option but you can change it to throw and this will result in an unhandled exception and YSOD (if customErrors is turned off)

    Dallas

  • Shannon Deminick 1524 posts 5270 karma points MVP 2x
    Jul 06, 2015 @ 11:32
    Shannon Deminick
    0

    Yes, we need to know what the actual error is. As noted by Dallas, the error should be in your log file, but you can also change your umbracoSettings.config setting:

     <MacroErrors>throw</MacroErrors>
    

    to be any of inline, silent or throw... putting it to 'throw' will show you the real ysod.

  • Craig Cronin 304 posts 503 karma points
    Jul 06, 2015 @ 11:34
    Craig Cronin
    0

    Thanks both,

    2015-07-06 12:30:27,238 [11] WARN umbraco.macro - [T38/D2] Error loading Partial View (file: ~/Views/MacroPartials/Search/SearchResults.cshtml). Exception: System.ApplicationException: Could not create an index searcher with the supplied lucene directory ---> Lucene.Net.Index.CorruptIndexException: doc counts differ for segment 0: fieldsReader shows 633 but segmentInfo shows 637 at Lucene.Net.Index.SegmentInfos.FindSegmentsFile.Run(IndexCommit commit) at Lucene.Net.Index.DirectoryReader.Open(Directory directory, IndexDeletionPolicy deletionPolicy, IndexCommit commit, Boolean readOnly, Int32 termInfosIndexDivisor) at Lucene.Net.Index.IndexReader.Open(Directory directory, IndexDeletionPolicy deletionPolicy, Boolean readOnly) at Examine.LuceneEngine.Providers.LuceneSearcher.ValidateSearcher(Boolean forceReopen) in x:\Projects\Examine\Examine\Projects\Examine\LuceneEngine\Providers\LuceneSearcher.cs:line 311 --- End of inner exception stack trace --- at Examine.LuceneEngine.Providers.LuceneSearcher.ValidateSearcher(Boolean forceReopen) in x:\Projects\Examine\Examine\Projects\Examine\LuceneEngine\Providers\LuceneSearcher.cs:line 412 at UmbracoExamine.UmbracoExamineSearcher.GetSearchFields() at UmbracoExamine.UmbracoExamineSearcher.CreateSearchCriteria(String type, BooleanOperation defaultOperation) at ASP.PageViewsMacroPartialsSearchSearchResults_cshtml.Execute() in d:\Websites\50014 - merthyr.gov.uk\Views\MacroPartials\Search\SearchResults.cshtml:line 21 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer) at Umbraco.Web.Mvc.ControllerExtensions.RenderViewResultAsString(ControllerBase controller, ViewResultBase viewResult) at Umbraco.Web.Macros.PartialViewMacroEngine.Execute(MacroModel macro, IPublishedContent content) at umbraco.macro.LoadPartialViewMacro(MacroModel macro) at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)

    This gives much more now :)

  • Craig Cronin 304 posts 503 karma points
    Jul 06, 2015 @ 11:36
    Craig Cronin
    0

    Dallas,

    I'd checked the umbraco log table but never seem to go to the txt file which was excellent.

    I'd also seen the config change but couldn't remember where I'd seen it, so another useful hint.

    I normally just debug/trace everything through visual studio.

  • Shannon Deminick 1524 posts 5270 karma points MVP 2x
    Jul 06, 2015 @ 11:36
    Shannon Deminick
    1

    what is in your examine config files? Are you doing some sort of load balancing, etc... ? what version of Umbraco?

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Jul 06, 2015 @ 11:37
    Ismail Mayat
    1

    Dallas,

    Did not know that about the macro inline option. Craig, in the backend are you able to view index manager or do you get errors there as well? If your still stuck you can skype me and screen share im on ismail_mayat

    Regards

    Ismail

  • Craig Cronin 304 posts 503 karma points
    Jul 06, 2015 @ 11:40
    Craig Cronin
    0

    Here they are and all looks fine

      <add name="CorporateIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
          supportUnpublished="false"
          supportProtected="true"
          interval="10"
          analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"
          indexSet="CorporateIndexSet"/>
    
    
    
          <add name="CorporateSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
              analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" indexSet="CorporateIndexSet" enableLeadingWildcards="true"/>
    
  • Craig Cronin 304 posts 503 karma points
    Jul 06, 2015 @ 11:43
    Craig Cronin
    0

    Ismail,

    Just checked the examine management on the staging site and it shows

    Examine Management Loading... Indexers

    Searchers

  • Dallas 132 posts 404 karma points
    Jul 06, 2015 @ 11:43
    Dallas
    1

    @Craig, most of the logging moved to the log files when log4net was added to Umbraco around v4.10. A lot of information gets logged to the file along with the errors and it can give some good insight into your Umbraco site.

    Regarding the examine issue - I don't know what this particular error is but I would

    • Delete everything in the \App_Data\TEMP\ExamineIndexes directory (on the staging web server)
    • Go to the Developer section of Umbraco and use the Examine Management dashboard to rebuild the indexes

    Dallas

  • Shannon Deminick 1524 posts 5270 karma points MVP 2x
    Jul 06, 2015 @ 11:47
    Shannon Deminick
    0

    I still need to know what version you are using, the more details you can provide, the easier/quicker it is to assist.

    The dashboard will say that because it has JS errors, you'll need to see what those are in the developer console of the web browser you are using.

  • Craig Cronin 304 posts 503 karma points
    Jul 06, 2015 @ 11:47
    Craig Cronin
    0

    Dallas/Ismail/Shannon,

    Really appreciate all the help guys, and think this is it.

    I've got 3 days before holidays and the site goes live when I'm back, so its been stressing me out.

    Also a couple of really useful tips.

    Thanks All.

  • Craig Cronin 304 posts 503 karma points
    Jul 06, 2015 @ 12:20
    Craig Cronin
    1

    Throwing the error, and rebuilding the indexes I have now fixed the problem.

    I have a multi project solution and it looks like one of the projects was referencing System.Web.Mvc 4.0.0.1 where my main Umbraco solution was using 4.0.0.0

    It was causing other minor issues such as a razor listing page was working on dev but not on the staging site.

    Apart from these very minor bits the site was running perfectly so didn't get picked up.

    Again, thanks to all.

Please Sign in or register to post replies

Write your reply to:

Draft