Skip to content

Commit

Permalink
Merge pull request #1004 from IgorAlymov/SITKO-CORE-T-24
Browse files Browse the repository at this point in the history
fix: fixed HighlightingTestAsync with tags
  • Loading branch information
pogromistik authored Aug 8, 2024
2 parents 80ac08b + cf5bc78 commit 4e5cf0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Sitko.Core.Search.OpenSearch/OpenSearchSearcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ private AnalysisDescriptor CreateAnalysisDescriptor(AnalysisDescriptor a) =>
.Filters("lowercase", "stop", "snowball", StemmerName))
.Custom(CustomCharFilterAnalyze, ca => ca
.Tokenizer("standard")
.Filters("lowercase", "stop")
.Filters("lowercase", "stop", "snowball", StemmerName)
.CharFilters(CustomCharFilter))
)
.CharFilters(descriptor =>
Expand Down
7 changes: 4 additions & 3 deletions tests/Sitko.Core.Search.OpenSearch.Tests/OpenSearchTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,11 @@ public async Task HighlightingTestAsync()
await searchProvider.AddOrUpdateEntitiesAsync(provider.Models.ToArray());
await Task.Delay(TimeSpan.FromSeconds(5));

var result = await searchProvider.SearchAsync("играют", 10, SearchType.Morphology, true);
var result = await searchProvider.SearchAsync("компьютерный", 10, SearchType.Morphology, true);
result.Length.Should().Be(1);
result.First().ResultModel.Highlight.Count.Should().Be(1);
result.First().ResultModel.Highlight.First().Value.Contains("<span class='highlight'>");
result.First().ResultModel.Highlight.First().Value.First().Contains("<span class='highlight'>").Should().BeTrue();
result.First().ResultModel.Highlight.First().Value.First().Contains("</span>").Should().BeTrue();
}
}

Expand All @@ -237,7 +238,7 @@ protected override IHostApplicationBuilder ConfigureApplication(IHostApplication
moduleOptions.DisableCertificatesValidation = true;
moduleOptions.CustomStemmer = "russian";
moduleOptions.PreTags = "<span class='highlight'>";
moduleOptions.PreTags = "</span>";
moduleOptions.PostTags = "</span>";
});

hostBuilder.Services.AddSingleton<TestModelProvider>();
Expand Down

0 comments on commit 4e5cf0d

Please sign in to comment.