mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Configured tokenization and storage for current indexed fields
Properties like dates, and slug should not be tokenized. Body is not stored. --HG-- branch : dev
This commit is contained in:
@@ -142,5 +142,20 @@ namespace Orchard.Tests.Indexing {
|
||||
Assert.IsNull(_provider.CreateSearchBuilder("default3").Get(1));
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IdentifierShouldNotCollide() {
|
||||
_provider.CreateIndex("default");
|
||||
_provider.Store("default", _provider.New(1).Add("field", "value1"));
|
||||
_provider.Store("default", _provider.New(11).Add("field", "value11"));
|
||||
_provider.Store("default", _provider.New(111).Add("field", "value111"));
|
||||
|
||||
var searchBuilder = _provider.CreateSearchBuilder("default");
|
||||
|
||||
Assert.That(searchBuilder.Get(1).Id, Is.EqualTo(1));
|
||||
Assert.That(searchBuilder.Get(11).Id, Is.EqualTo(11));
|
||||
Assert.That(searchBuilder.Get(111).Id, Is.EqualTo(111));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -10,8 +10,8 @@ namespace Orchard.Core.Common.Handlers {
|
||||
Filters.Add(StorageFilter.For(bodyRepository));
|
||||
|
||||
OnIndexing<BodyAspect>((context, bodyAspect) => context.IndexDocument
|
||||
.Add("body", bodyAspect.Record.Text)
|
||||
.Add("format", bodyAspect.Record.Format));
|
||||
.Add("body", bodyAspect.Record.Text).Store(false)
|
||||
.Add("format", bodyAspect.Record.Format).Analyze(false));
|
||||
}
|
||||
}
|
||||
}
|
@@ -56,11 +56,11 @@ namespace Orchard.Core.Common.Handlers {
|
||||
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)
|
||||
.Add("type", commonAspect.ContentItem.ContentType).Analyze(false)
|
||||
.Add("author", commonAspect.Owner.UserName).Analyze(false)
|
||||
.Add("created", commonAspect.CreatedUtc ?? _clock.UtcNow).Analyze(false)
|
||||
.Add("published", commonAspect.PublishedUtc ?? _clock.UtcNow).Analyze(false)
|
||||
.Add("modified", commonAspect.ModifiedUtc ?? _clock.UtcNow).Analyze(false))
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -37,7 +37,7 @@ namespace Orchard.Core.Common.Handlers {
|
||||
OnCreated<RoutableAspect>((context, ra) => routableService.ProcessSlug(ra));
|
||||
|
||||
OnIndexing<RoutableAspect>((context, part) => context.IndexDocument
|
||||
.Add("slug", part.Slug)
|
||||
.Add("slug", part.Slug).Analyze(false)
|
||||
.Add("title", part.Title)
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user