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 ?
@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);
}
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) :-)
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.
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?
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 .
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:
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?
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()
{
}
}
}
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 .
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
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
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
Issue now resolved add some code to check if the directory is locked and unlock it .. thanks for the help
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
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
@Zac if you update the code to this to the ExamineComponent.cs (which is in application/initialization folder)
I am facing the same problem and would like to try your solution here - where exactly do we put that code chunk? :-)
Hi thomsen its under Application/Initialization/ you will see the file ExamineComponent.cs
andy
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.
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
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?
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 .
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:
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
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?
For better overview my overriding class now looks like this:
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 .
Thanks, Andy!
is working on a reply...