Skip to content

Commit

Permalink
Fixed temporal query response not prefetching objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
Spiess committed Jan 4, 2023
1 parent 58b4b53 commit ed4a41d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Linq;
using System.Threading.Tasks;
using Org.Vitrivr.CineastApi.Model;
using UnityEngine;
using Vitrivr.UnityInterface.CineastApi.Model.Registries;

namespace Vitrivr.UnityInterface.CineastApi.Model.Data
Expand All @@ -25,13 +26,21 @@ public TemporalQueryResponse(TemporalQuery query, TemporalQueryResult resultsMes

public async Task Prefetch(int number)
{
// Segments
// Convert to hash set to ensure uniqueness
var segmentSet = ResultsMessage.Content.Take(number)
.SelectMany(result => result.Segments
.Select(_multimediaRegistry.GetSegment)
).ToHashSet();

await _multimediaRegistry.BatchFetchSegmentData(segmentSet.ToList());

// Objects
var objectSet = ResultsMessage.Content.Take(number)
.Select(result => _multimediaRegistry.GetObject(result.ObjectId)
).ToHashSet();

await _multimediaRegistry.BatchFetchObjectData(objectSet.ToList());
}

private TemporalResult TemporalObjectToResult(TemporalObject temporalObject)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "org.vitrivr.unityinterface.cineastapi",
"version": "0.1.0",
"version": "0.1.1",
"displayName": "Cineast Unity Interface",
"description": "An all-unity client for [Cineast](https://github.com/vitrivr/cineast/).",
"unity": "2020.3",
Expand Down

0 comments on commit ed4a41d

Please sign in to comment.