You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're using Umbraco v8.14.1 with Examine dll v1.2.2.0 & Lucene v3.0.3.
We're also using this package for our search functionality of the website: https://github.com/skttl/umbraco-fulltextsearch8
I've been debugging for a while using the Umbraco mini profiler and I've noticed one line of code slowing down the whole code by a lot.
First we get the results, no issues there with a maxResults of 12 var results = searcher.CreateQuery().NativeQuery(query.ToString()).Execute(_search.PageLength * _currentPage);
results type is 'Examine.ISearchResults'
The slow code: result.TotalResults = results.TotalItemCount;
Our indexCreator:
public class NewsIndexCreator : LuceneIndexCreator
{
private readonly IProfilingLogger _profilingLogger;
private readonly ILocalizationService _localizationService;
private readonly IPublicAccessService _publicAccessService;
public NewsIndexCreator(IProfilingLogger profilingLogger,
ILocalizationService localizationService,
IPublicAccessService publicAccessService
)
{
_profilingLogger = profilingLogger;
_localizationService = localizationService;
_publicAccessService = publicAccessService;
}
public override IEnumerable<IIndex> Create()
{
var fieldDefinitionCollection = new FieldDefinitionCollection();
foreach(var language in _localizationService.GetAllLanguages())
{
fieldDefinitionCollection.AddOrUpdate(new FieldDefinition($"updateDate_{language.CultureInfo}_sort", FieldDefinitionTypes.DateTime));
fieldDefinitionCollection.AddOrUpdate(new FieldDefinition($"createDate_{language.CultureInfo}_sort", FieldDefinitionTypes.DateTime));
fieldDefinitionCollection.AddOrUpdate(new FieldDefinition($"sortDate_{language.CultureInfo}_sort", FieldDefinitionTypes.DateTime));
}
var index = new UmbracoContentIndex("NewsIndex",
CreateFileSystemLuceneDirectory("NewsIndex"),
fieldDefinitionCollection,
new StandardAnalyzer(Version.LUCENE_30),
_profilingLogger,
_localizationService,
new ContentValueSetValidator(true, false, _publicAccessService, includeItemTypes: new string[] { "newsItem" }));
return new[] { index };
}
}
Any ideas how we could fix this problem?
Thanks in advance and happy holidays!
The text was updated successfully, but these errors were encountered:
Hi, Examine will execute the Lucene query lazily one time when either TotalItemCount is resolved, or when the search results are enumerated. My gut feeling is that you are resolving TotalItemCount first which will seem to indicate the performance problem is reading that property, however what is most likely occurring is that it is executing the search at that time.
Hello!
We're using Umbraco v8.14.1 with Examine dll v1.2.2.0 & Lucene v3.0.3.
We're also using this package for our search functionality of the website: https://github.com/skttl/umbraco-fulltextsearch8
I've been debugging for a while using the Umbraco mini profiler and I've noticed one line of code slowing down the whole code by a lot.
First we get the results, no issues there with a maxResults of 12
var results = searcher.CreateQuery().NativeQuery(query.ToString()).Execute(_search.PageLength * _currentPage);
results type is 'Examine.ISearchResults'
The slow code:
result.TotalResults = results.TotalItemCount;
Our indexCreator:
Any ideas how we could fix this problem?
Thanks in advance and happy holidays!
The text was updated successfully, but these errors were encountered: