Populate search index snapshots from main handlers (common, body and routable)

--HG--
branch : dev
This commit is contained in:
Sebastien Ros
2010-06-02 16:52:52 -07:00
parent 46e6e1e930
commit cb3ab26859
3 changed files with 15 additions and 3 deletions

View File

@@ -9,9 +9,9 @@ namespace Orchard.Core.Common.Handlers {
public BodyAspectHandler(IRepository<BodyRecord> bodyRepository) {
Filters.Add(StorageFilter.For(bodyRepository));
OnIndexing<BodyAspect>((context, bodyAspect) => {
context.IndexDocument.Add("body", bodyAspect.Record.Text);
});
OnIndexing<BodyAspect>((context, bodyAspect) => context.IndexDocument
.Add("body", bodyAspect.Record.Text)
.Add("format", bodyAspect.Record.Format));
}
}
}

View File

@@ -54,6 +54,14 @@ namespace Orchard.Core.Common.Handlers {
//OnGetDisplayViewModel<CommonAspect>();
OnGetEditorViewModel<CommonAspect>(GetEditor);
OnUpdateEditorViewModel<CommonAspect>(UpdateEditor);
OnIndexing<CommonAspect>((context, commonAspect) => context.IndexDocument
.Add("type", commonAspect.ContentItem.ContentType)
.Add("author", commonAspect.Owner.UserName)
.Add("created", commonAspect.CreatedUtc ?? _clock.UtcNow)
.Add("published", commonAspect.PublishedUtc ?? _clock.UtcNow)
.Add("modified", commonAspect.ModifiedUtc ?? _clock.UtcNow)
);
}
public Localizer T { get; set; }

View File

@@ -36,6 +36,10 @@ namespace Orchard.Core.Common.Handlers {
OnCreated<RoutableAspect>((context, ra) => routableService.ProcessSlug(ra));
OnIndexing<RoutableAspect>((context, part) => context.IndexDocument
.Add("slug", part.Slug)
.Add("title", part.Title)
);
}
private static RouteValueDictionary GetRouteValues(IContentItemDriver driver, ContentItem contentItem) {