Copied to clipboard

Flag this post as spam?

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


  • Andy Finn 51 posts 183 karma points
    Aug 01, 2019 @ 09:49
    Andy Finn
    0

    Examine Indexer

    Getting the error Error the indexer is locked : cannot index queue items, the index is currently locked site:our.umbraco.com . So search just crashes if been used. I have restarted the App in Azure / how do you Force Unlock it ? I tried also from UI , it just crashes out and cant get to any of the settings ? Umbraco 8.0.2 version I see lots of comments on forum for umbraco 7 , update settings but i dont think in the code there is any settings i can change to force the unlock ?

    thanks in advance Andy

  • Nik 1593 posts 7151 karma points MVP 6x c-trib
    Aug 01, 2019 @ 10:46
    Nik
    0

    Hi Andy,

    Have you configured Examine for working in an Azure Web App ?

    There are various AppSettings that you need to add so it works correctly with how Azure works.

    Thanks

    Nik

  • Andy Finn 51 posts 183 karma points
    Aug 01, 2019 @ 10:54
    Andy Finn
    0

    thanks Nik, https://our.umbraco.com/documentation/Getting-Started/Setup/Server-Setup/azure-web-apps#examine-v0180 , i followed this But in Umbraco 8 there is no examine.config settings ( not that i can find) , strange this is the we have dev site and search is fine ( also in Azure) but the production has the index lock .

    also followed this : https://our.umbraco.com/forum/using-umbraco-and-getting-started/90867-examine-lock-error-brings-down-azure-site But this seems more directed for umbraco7 than 8

    Thanks Andy

  • Andy Finn 51 posts 183 karma points
    Aug 01, 2019 @ 19:23
    Andy Finn
    100

    Issue now resolved add some code to check if the directory is locked and unlock it .. thanks for the help

  • Nik 1593 posts 7151 karma points MVP 6x c-trib
    Aug 01, 2019 @ 20:21
    Nik
    0

    Hey Andy,

    Pleased to hear you sorted it. For reference the v8 version of the umbraco settings can be found here https://github.com/umbraco/Umbraco-CMS/issues/5035#issuecomment-476477802

    They are now app settings so live in Web.config.

    It's worth reading that entire issue though just as odd things can happen.

    Nik

  • Zac 239 posts 541 karma points
    Sep 18, 2019 @ 17:55
    Zac
    0

    Hi Andy,

    We're running into the same issue. Would you mind sharing your code / approach to fix the issue? We'd greatly appreciate it.

    Thanks

  • Andy Finn 51 posts 183 karma points
    Sep 19, 2019 @ 11:43
    Andy Finn
    1

    @Zac if you update the code to this to the ExamineComponent.cs (which is in application/initialization folder)

    DirectoryFactory.DefaultLockFactory = d =>
            {
                var simpleFsLockFactory = new NoPrefixSimpleFsLockFactory(d);
                return simpleFsLockFactory;
            };
            foreach (var index in _indexCreator.Create()) { 
                if (index is LuceneIndex)
                {
                    var luceneIndex = index as LuceneIndex;
                    var dir = luceneIndex.GetLuceneDirectory();
                    if (IndexWriter.IsLocked(dir))
                    {
                        IndexWriter.Unlock(dir);
                    }
                }
            _examineManager.AddIndex(index);
            }
    
  • Thomsen 112 posts 335 karma points
    Mar 19, 2020 @ 13:18
    Thomsen
    0

    I am facing the same problem and would like to try your solution here - where exactly do we put that code chunk? :-)

  • Andy Finn 51 posts 183 karma points
    Mar 19, 2020 @ 13:26
    Andy Finn
    0

    Hi thomsen its under Application/Initialization/ you will see the file ExamineComponent.cs

    andy

  • Thomsen 112 posts 335 karma points
    Mar 19, 2020 @ 23:56
    Thomsen
    0

    Hi Andy - thank you for the quick answer. I may be a bit lost here - it's because I'm running a NuGet installation of Umbraco, so the .cs-files are not there. I can find the ExamineComponent.cs file if I download the source Umbraco project, but how do I integrate my altered ExamineComponent.cs file in the pre-compiled Umbraco installation so it overrules the existing dll's? - Should I just place the file in a folder in the project and hit Build? (Sorry for misunderstanding) :-)

    Kind regards.

  • Andy Finn 51 posts 183 karma points
    Mar 21, 2020 @ 16:48
    Andy Finn
    0

    Hi even with Nuget package , it creates a Visual Studio ASP.NET app , you need to open that in Visual Studio ? Then once you make the change it complies the dll during the build.

    Is this what you did ? https://our.umbraco.com/documentation/Getting-Started/Setup/Install/install-umbraco-with-nuget , you need to open it in VS or VS code , press ctrl f (find) examine . then make the changes to original file or replace their with yours , then when you run a build , it re-creates the dll for u. Hope that makes sense Andy

  • Thomsen 112 posts 335 karma points
    Mar 21, 2020 @ 21:38
    Thomsen
    0

    Hi Andy, thanks again for the quick answer. It is exactly that way I install via NuGet, but no .cs-files are included in the installation - only compiled .dll's and the only search result of "Examine" is the Umbraco.Examine.dll file and the examine indexes folders in the TEMP folder. Should I tick something or select anything additional in the NuGet installation process to get all the .cs files included in the VS project?

  • Andy Finn 51 posts 183 karma points
    Mar 22, 2020 @ 00:29
    Andy Finn
    0

    Sounds like you need to include them in project , if you click show all files in Solution explorer of VS project ( the one with picture of folders) , they are there , You should see a bunch of empty folders ,if Right click on the folder above include them in the project. If you still cant see them , can you screen shot your solution in vs ? of the file structure ? Also this is for v8 Umbraco not 7 , just in case .

  • Thomsen 112 posts 335 karma points
    Mar 22, 2020 @ 19:32
    Thomsen
    0

    Hi Andy, I just ran a fresh NuGet install, in case I haved missed something in my other solution. As you see from the screenshot here, there are no .cs source files included. Only a lot of compiled dll's in the bin folder:

    enter image description here

    enter image description here

  • Andy Finn 51 posts 183 karma points
    Mar 22, 2020 @ 21:36
    Andy Finn
    0

    I see , i download a Nuget package i see that it is not there also .
    I do some digging it been a while since i installed from scratch . The Files are here : https://github.com/umbraco/Umbraco-CMS in the github of umbraco . It you check the src folder . So you might need to create a custom class to override the examinecomposer.cs in the package . https://our.umbraco.com/documentation/reference/searching/examine/indexing/ for more info

  • Thomsen 112 posts 335 karma points
    Mar 23, 2020 @ 18:43
    Thomsen
    0

    Hi Andy, I really apreciate your help. I followed your link and read up on writing a custom class to overrule the examinecomposer.cs. I think it's almost there, except for an error when adding the index to the _examineManager. Should I just unluck the IndexWriter, and avoid adding it to the _examineManager again?

    enter image description here

  • Thomsen 112 posts 335 karma points
    Mar 23, 2020 @ 18:47
    Thomsen
    0

    For better overview my overriding class now looks like this:

    using Examine;
    using Examine.LuceneEngine.Directories; 
    using Examine.LuceneEngine.Providers;
    using Lucene.Net.Index;
    using Umbraco.Core.Composing;
    using Umbraco.Examine;
    using Umbraco.Web.Search;
    
    namespace MyProject.Components
    {    
    public class CustomizedExamineComposer : ComponentComposer<CustomizedExamineComponent> { }
    
    public class CustomizedExamineComponent : IComponent
    {
        private readonly IExamineManager _examineManager;
        private readonly IUmbracoIndexesCreator _indexCreator;
    
        public CustomizedExamineComponent(IExamineManager examineManager, IUmbracoIndexesCreator indexCreator)
        {
            _examineManager = examineManager;
            _indexCreator = indexCreator;
        }
    
        public void Initialize()
        {
            DirectoryFactory.DefaultLockFactory = d =>
            {
                var simpleFsLockFactory = new NoPrefixSimpleFsLockFactory(d);
                return simpleFsLockFactory;
            };
    
            foreach (var index in _indexCreator.Create())
            {
                if (index is LuceneIndex)
                {
                    var luceneIndex = index as LuceneIndex;
                    var dir = luceneIndex.GetLuceneDirectory();
                    if (IndexWriter.IsLocked(dir))
                    {
                        IndexWriter.Unlock(dir);
                    }
                }
                _examineManager.AddIndex(index);
            }
        }
    
        public void Terminate()
        {
        }
    }
    }
    
  • Andy Finn 51 posts 183 karma points
    Mar 23, 2020 @ 21:44
    Andy Finn
    0

    Correct you shouldn't need to re-add as then the internal index already exists, Because you are iterating through the indexes anyway I had to re-add because i have custom search index .

  • Zac 239 posts 541 karma points
    Sep 19, 2019 @ 14:58
    Zac
    0

    Thanks, Andy!

Please Sign in or register to post replies

Write your reply to:

Draft