Browse Source

Potentially fix serialization for full text in cluster.

pull/459/head
Sebastian 6 years ago
parent
commit
d170a694e9
  1. 2
      backend/src/Squidex.Domain.Apps.Entities.MongoDb/FullText/MongoDirectoryFactory.cs
  2. 2
      backend/src/Squidex.Domain.Apps.Entities/Contents/Text/IndexHolder.cs
  3. 21
      backend/src/Squidex.Domain.Apps.Entities/Contents/Text/TextContent.cs
  4. 2
      backend/src/Squidex.Domain.Apps.Entities/Contents/Text/TextIndexContent.cs
  5. 6
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/GrainTextIndexerTests.cs
  6. 1
      frontend/app/features/administration/pages/cluster/cluster-page.component.scss

2
backend/src/Squidex.Domain.Apps.Entities.MongoDb/FullText/MongoDirectoryFactory.cs

@ -26,7 +26,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.FullText
{
var folderName = schemaId.ToString();
var tempFolder = Path.Combine(Path.GetTempPath(), folderName);
var tempFolder = Path.Combine(Path.GetTempPath(), "Indices", folderName);
var tempDirectory = new DirectoryInfo(tempFolder);
return new MongoDirectory(bucket, folderName, tempDirectory);

2
backend/src/Squidex.Domain.Apps.Entities/Contents/Text/IndexHolder.cs

@ -95,7 +95,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text
{
if (disposing)
{
indexWriter.Dispose();
indexWriter?.Dispose();
}
}

21
backend/src/Squidex.Domain.Apps.Entities/Contents/Text/TextContent.cs

@ -12,13 +12,24 @@ using Squidex.Domain.Apps.Core.Contents;
using Squidex.Infrastructure;
using Squidex.Infrastructure.Json.Objects;
#pragma warning disable ORL1001
namespace Squidex.Domain.Apps.Entities.Contents.Text
{
[Serializable]
public sealed class TextContent : Dictionary<string, string>
public sealed class TextContent
{
public Dictionary<string, string> Texts { get; } = new Dictionary<string, string>();
public string this[string key]
{
get
{
return Texts.GetOrDefault(key) ?? string.Empty;
}
set
{
Texts[key] = value;
}
}
public TextContent()
{
}
@ -62,7 +73,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text
foreach (var kvp in languages)
{
this[kvp.Key] = kvp.Value.ToString();
Texts[kvp.Key] = kvp.Value.ToString();
}
}

2
backend/src/Squidex.Domain.Apps.Entities/Contents/Text/TextIndexContent.cs

@ -122,7 +122,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text
{
var document = new Document();
foreach (var field in text)
foreach (var field in text.Texts)
{
document.AddTextField(field.Key, field.Value, Field.Store.NO);
}

6
backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/GrainTextIndexerTests.cs

@ -54,7 +54,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text
{
await sut.On(E(new ContentCreated()));
A.CallTo(() => grain.IndexAsync(A<Update>.That.Matches(x => x.Text.Count == 0 && x.Id == contentId && x.OnlyDraft)))
A.CallTo(() => grain.IndexAsync(A<Update>.That.Matches(x => x.Text.Texts.Count == 0 && x.Id == contentId && x.OnlyDraft)))
.MustHaveHappened();
}
@ -63,7 +63,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text
{
await sut.On(E(new ContentUpdated()));
A.CallTo(() => grain.IndexAsync(A<Update>.That.Matches(x => x.Text.Count == 0 && x.Id == contentId && !x.OnlyDraft)))
A.CallTo(() => grain.IndexAsync(A<Update>.That.Matches(x => x.Text.Texts.Count == 0 && x.Id == contentId && !x.OnlyDraft)))
.MustHaveHappened();
}
@ -72,7 +72,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text
{
await sut.On(E(new ContentUpdateProposed()));
A.CallTo(() => grain.IndexAsync(A<Update>.That.Matches(x => x.Text.Count == 0 && x.Id == contentId && x.OnlyDraft)))
A.CallTo(() => grain.IndexAsync(A<Update>.That.Matches(x => x.Text.Texts.Count == 0 && x.Id == contentId && x.OnlyDraft)))
.MustHaveHappened();
}

1
frontend/app/features/administration/pages/cluster/cluster-page.component.scss

@ -3,6 +3,7 @@
iframe {
@include absolute(0, 0, 0, 0);
@include force-height(100%);
@include force-width(100%);
border: 0;
}
Loading…
Cancel
Save