Browse Source
Merge pull request #17298 from abpframework/EngincanV/fix-duplicate-results
Docs: Fix duplicate document results in search
pull/17306/head
liangshiwei
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
7 additions and
0 deletions
-
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) |
|
|
foreach (var hit in response.Hits) |
|
|
{ |
|
|
{ |
|
|
var doc = hit.Source; |
|
|
var doc = hit.Source; |
|
|
|
|
|
if(docs.Any(x => x.Id == doc.Id)) |
|
|
|
|
|
{ |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (hit.Highlight.ContainsKey("content")) |
|
|
if (hit.Highlight.ContainsKey("content")) |
|
|
{ |
|
|
{ |
|
|
doc.Highlight = new List<string>(); |
|
|
doc.Highlight = new List<string>(); |
|
|
doc.Highlight.AddRange(hit.Highlight["content"]); |
|
|
doc.Highlight.AddRange(hit.Highlight["content"]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
docs.Add(doc); |
|
|
docs.Add(doc); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|