Updates the member indexer to re-index all members WAY faster than before. Updates the search controller to limit search results to 200 otherwise a ton of CPU can be used if there's thousands of results.

This commit is contained in:
Shannon
2014-09-30 12:08:21 +10:00
parent 1f01001d16
commit c49560f39d
2 changed files with 5 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ using System.Web.Http;
using System.Web.Http.ModelBinding;
using AutoMapper;
using Examine.LuceneEngine;
using Examine.LuceneEngine.Providers;
using Newtonsoft.Json;
using Umbraco.Core;
using Umbraco.Core.Logging;
@@ -282,7 +283,7 @@ namespace Umbraco.Web.Editors
throw new NotSupportedException("The " + typeof(EntityController) + " currently does not support searching against object type " + entityType);
}
var internalSearcher = ExamineManager.Instance.SearchProviderCollection[searcher];
var internalSearcher = (LuceneSearcher)ExamineManager.Instance.SearchProviderCollection[searcher];
//build a lucene query:
// the __nodeName will be boosted 10x without wildcards
@@ -374,7 +375,8 @@ namespace Umbraco.Web.Editors
var raw = internalSearcher.CreateSearchCriteria().RawQuery(sb.ToString());
var result = internalSearcher.Search(raw);
//limit results to 200 to avoid huge over processing (CPU)
var result = internalSearcher.Search(raw, 200);
switch (entityType)
{

View File

@@ -95,7 +95,7 @@ namespace UmbracoExamine
int total;
members = ApplicationContext.Current.Services.MemberService.GetAll(pageIndex, pageSize, out total);
//AddNodesToIndex(GetSerializedMembers(members), type);
AddNodesToIndex(GetSerializedMembers(members), type);
pageIndex++;