Copied to clipboard

Flag this post as spam?

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


  • Kevin C. Halpin 22 posts 102 karma points
    Aug 09, 2018 @ 21:53
    Kevin C. Halpin
    0

    Examine - AlreadyClosedException

    Hi all, I am using Umbraco Examine to search through the nodes. I've got the simplest configuration that is in Examine quick start guide and then I use the searcher like this

     var Searcher = ExamineManager.Instance.SearchProviderCollection["ExternalSearcher"];
            var searchCriteria = Searcher.CreateSearchCriteria();
            var query = searchCriteria.Field("nodeTypeAlias", nodeTypeAlias);
            if (keyword != "")
            {
                query.And().GroupedOr(new string[] { "title", "description" }, keyword);
            }
    
            if (categories != "")
            {
                query.And().GroupedOr(new string[] { "categories" }, categories.Split(','));
            }
    
            if (tags != "")
            {
                query.And().GroupedOr(new string[] { "tags" }, tags.Split(','));
            }
    
            return Searcher.Search(query.Compile());
    

    Locally everthing works fine. When I add a node through CMS (example hotel) the API that returns all the hotels is updated. I can unpublish the node I just added, everything is OK. BUT, on prod examine is not working. When I add new hotel and then call the hotels API I get an error "ExceptionMessage": "this IndexReader is closed", "ExceptionType": "Lucene.Net.Store.AlreadyClosedException".

    Weird thing is when I then run the website locally (I use the same database connection string locally and on prod) it seems that the indexer is updated and then when I try to call the API again everything is OK. That made me believe that I should maybe rebuild the indexer so I added this line to "published" and "saved" Umbraco events

    ExamineManager.Instance.IndexProviderCollection["ExternalIndexer"].RebuildIndex();
    

    but that didn't help. I just can't understand why locally everything works fine but on prod it is not. I am using a VPS, Windows server 2008 R2, I don't have much experience in hosting (I copied all the folders in my website physical path, including AppData, Umbraco, UmbracoClient... ) and I don't know If I did that right. I mean everything is working except for this. Please help. I'd be happy to provide more details just comment please. BR, Kevin

Please Sign in or register to post replies

Write your reply to:

Draft