Browse Source

Docs: Fix duplicate document results in search

pull/17298/head
Engincan VESKE 3 years ago
parent
commit
734c72f7f7
  1. 7
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/FullSearch/Elastic/ElasticDocumentFullSearch.cs

7
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/FullSearch/Elastic/ElasticDocumentFullSearch.cs

@ -204,11 +204,18 @@ namespace Volo.Docs.Documents.FullSearch.Elastic
foreach (var hit in response.Hits)
{
var doc = hit.Source;
if(docs.Any(x => x.Id == doc.Id))
{
continue;
}
if (hit.Highlight.ContainsKey("content"))
{
doc.Highlight = new List<string>();
doc.Highlight.AddRange(hit.Highlight["content"]);
}
docs.Add(doc);
}

Loading…
Cancel
Save