@@ -231,8 +231,8 @@ private void RegisterResultsUpdatedEvent()
231
231
232
232
var token = e . Token == default ? _updateToken : e . Token ;
233
233
234
- // make a copy of results to avoid plugin change the result when updating view model
235
- var resultsCopy = e . Results . ToList ( ) ;
234
+ // make a clone to avoid possible issue that plugin will also change the list and items when updating view model
235
+ var resultsCopy = DeepCloneResults ( e . Results , token ) ;
236
236
237
237
PluginManager . UpdatePluginMetadata ( resultsCopy , pair . Metadata , e . Query ) ;
238
238
if ( ! _resultsUpdateChannelWriter . TryWrite ( new ResultsForUpdate ( resultsCopy , pair . Metadata , e . Query ,
@@ -414,6 +414,22 @@ private async Task OpenResultAsync(string index)
414
414
}
415
415
}
416
416
417
+ private static IReadOnlyList < Result > DeepCloneResults ( IReadOnlyList < Result > results , CancellationToken token = default )
418
+ {
419
+ var resultsCopy = new List < Result > ( ) ;
420
+ foreach ( var result in results . ToList ( ) )
421
+ {
422
+ if ( token . IsCancellationRequested )
423
+ {
424
+ break ;
425
+ }
426
+
427
+ var resultCopy = result . Clone ( ) ;
428
+ resultsCopy . Add ( resultCopy ) ;
429
+ }
430
+ return resultsCopy ;
431
+ }
432
+
417
433
#endregion
418
434
419
435
#region BasicCommands
@@ -1469,9 +1485,9 @@ public void UpdateResultView(ICollection<ResultsForUpdate> resultsForUpdates)
1469
1485
{
1470
1486
if ( _topMostRecord . IsTopMost ( result ) )
1471
1487
{
1472
- result . Score = Result . MaxScore ;
1488
+ result . Score = 100000 ; // Result.MaxScore;
1473
1489
}
1474
- else if ( result . Score != Result . MaxScore )
1490
+ else
1475
1491
{
1476
1492
var priorityScore = metaResults . Metadata . Priority * 150 ;
1477
1493
result . Score += result . AddSelectedCount ?
0 commit comments