Shows how to search across indexed videos using a text query.
This example assumes using TwelveLabs; is in scope and apiKey contains your TwelveLabs API key.
1 2 3 4 5 6 7 8 91011121314151617181920
usingvarclient=newTwelveLabsClient(apiKey);// Retrieve the first index to use for searching.varindexes=awaitclient.SubpackageIndexes.ListAsync(xApiKey:apiKey);varindexId=indexes.Data?.FirstOrDefault()?.Id??thrownewAssertInconclusiveException("No indexes found. Create an index and upload videos first.");// Search for video segments matching a text query using visual search.varresults=awaitclient.SubpackageSearch.CreateAsync(xApiKey:apiKey,indexId:indexId,queryText:"a person walking",searchOptions:[SearchPostRequestBodyContentMultipartFormDataSchemaSearchOptionsItems.Visual]);// The response contains matching video clips with timestamps and relevance ranking.foreach(variteminresults.Data!){Console.WriteLine($"Video: {item.VideoId}, Start: {item.Start}s, End: {item.End}s, Rank: {item.Rank}");}