Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AIDevGallery/Samples/WCRAPIs/AppIndexCapability.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using AIDevGallery.Models;
using AIDevGallery.Samples.Attributes;
using Microsoft.UI.Xaml.Navigation;
using Microsoft.Windows.AI.Search.Experimental.AppContentIndex;
using Microsoft.Windows.Search.AppContentIndex;

Check failure on line 7 in AIDevGallery/Samples/WCRAPIs/AppIndexCapability.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-arm64

The type or namespace name 'Search' does not exist in the namespace 'Microsoft.Windows' (are you missing an assembly reference?)

Check failure on line 7 in AIDevGallery/Samples/WCRAPIs/AppIndexCapability.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-x64

The type or namespace name 'Search' does not exist in the namespace 'Microsoft.Windows' (are you missing an assembly reference?)

Check failure on line 7 in AIDevGallery/Samples/WCRAPIs/AppIndexCapability.xaml.cs

View workflow job for this annotation

GitHub Actions / Unit Tests - win-x64

The type or namespace name 'Search' does not exist in the namespace 'Microsoft.Windows' (are you missing an assembly reference?)
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand All @@ -25,7 +25,7 @@

internal sealed partial class AppIndexCapability : BaseSamplePage
{
private AppContentIndexer? _indexer;

Check failure on line 28 in AIDevGallery/Samples/WCRAPIs/AppIndexCapability.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-arm64

The type or namespace name 'AppContentIndexer' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 28 in AIDevGallery/Samples/WCRAPIs/AppIndexCapability.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-x64

The type or namespace name 'AppContentIndexer' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 28 in AIDevGallery/Samples/WCRAPIs/AppIndexCapability.xaml.cs

View workflow job for this annotation

GitHub Actions / Unit Tests - win-x64

The type or namespace name 'AppContentIndexer' could not be found (are you missing a using directive or an assembly reference?)

public AppIndexCapability()
{
Expand Down Expand Up @@ -79,7 +79,7 @@

private void CleanUp()
{
_indexer?.RemoveAll();
_indexer?.RemoveAllContentItems();
_indexer?.Dispose();
_indexer = null;
}
Expand Down Expand Up @@ -172,7 +172,7 @@
});
}

private void Listener_IndexCapabilitiesChanged(AppContentIndexer indexer, IndexCapabilities statusResult)

Check failure on line 175 in AIDevGallery/Samples/WCRAPIs/AppIndexCapability.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-arm64

The type or namespace name 'IndexCapabilities' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 175 in AIDevGallery/Samples/WCRAPIs/AppIndexCapability.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-arm64

The type or namespace name 'AppContentIndexer' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 175 in AIDevGallery/Samples/WCRAPIs/AppIndexCapability.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-x64

The type or namespace name 'IndexCapabilities' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 175 in AIDevGallery/Samples/WCRAPIs/AppIndexCapability.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-x64

The type or namespace name 'AppContentIndexer' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 175 in AIDevGallery/Samples/WCRAPIs/AppIndexCapability.xaml.cs

View workflow job for this annotation

GitHub Actions / Unit Tests - win-x64

The type or namespace name 'IndexCapabilities' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 175 in AIDevGallery/Samples/WCRAPIs/AppIndexCapability.xaml.cs

View workflow job for this annotation

GitHub Actions / Unit Tests - win-x64

The type or namespace name 'AppContentIndexer' could not be found (are you missing a using directive or an assembly reference?)
{
LoadAppIndexCapabilities();
}
Expand Down
11 changes: 5 additions & 6 deletions AIDevGallery/Samples/WCRAPIs/KnowledgeRetrieval.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using Microsoft.Windows.AI.Search.Experimental.AppContentIndex;
using Microsoft.Windows.Search.AppContentIndex;

Check failure on line 13 in AIDevGallery/Samples/WCRAPIs/KnowledgeRetrieval.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-arm64

The type or namespace name 'Search' does not exist in the namespace 'Microsoft.Windows' (are you missing an assembly reference?)

Check failure on line 13 in AIDevGallery/Samples/WCRAPIs/KnowledgeRetrieval.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-x64

The type or namespace name 'Search' does not exist in the namespace 'Microsoft.Windows' (are you missing an assembly reference?)

Check failure on line 13 in AIDevGallery/Samples/WCRAPIs/KnowledgeRetrieval.xaml.cs

View workflow job for this annotation

GitHub Actions / Unit Tests - win-x64

The type or namespace name 'Search' does not exist in the namespace 'Microsoft.Windows' (are you missing an assembly reference?)
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
Expand Down Expand Up @@ -58,14 +58,14 @@
// This is some text data that we want to add to the index:
private Dictionary<string, string> simpleTextData = new Dictionary<string, string>
{
{ "item1", "Preparing a hearty vegetable stew begins with chopping fresh carrots, onions, and celery. Sauté them in olive oil until fragrant, then add diced tomatoes, herbs, and vegetable broth. Simmer gently for an hour, allowing flavors to meld into a comforting dish perfect for cold evenings." },
{ "item1", "Preparing a hearty vegetable stew begins with chopping fresh carrots, onions, and celery. Saut� them in olive oil until fragrant, then add diced tomatoes, herbs, and vegetable broth. Simmer gently for an hour, allowing flavors to meld into a comforting dish perfect for cold evenings." },
{ "item2", "Modern exhibition design combines narrative flow with spatial strategy. Lighting emphasizes focal objects while circulation paths avoid bottlenecks. Materials complement artifacts without visual competition. Interactive elements invite engagement but remain intuitive. Environmental controls protect sensitive works. Success balances scholarship, aesthetics, and visitor experience through thoughtful, cohesive design choices." },
{ "item3", "Domestic cats communicate through posture, tail flicks, and vocalizations. Play mimics hunting behaviors like stalking and pouncing, supporting agility and mental stimulation. Scratching maintains claws and marks territory, so provide sturdy posts. Balanced diets, hydration, and routine veterinary care sustain health. Safe retreats and vertical spaces reduce stress and encourage exploration." },
{ "item4", "Snowboarding across pristine slopes combines agility, balance, and speed. Riders carve smooth turns on powder, adjust stance for control, and master jumps in terrain parks. Essential gear includes boots, bindings, and helmets for safety. Embrace crisp alpine air while perfecting tricks and enjoying the thrill of winter adventure." },
{ "item5", "Urban beekeeping thrives with diverse forage across seasons. Rooftop hives benefit from trees, herbs, and staggered blooms. Provide shallow water sources and shade to counter heat stress. Prevent swarms through timely inspections and splits. Monitor mites with sugar rolls and rotate treatments. Honey reflects city terroir with surprising floral complexity." }
};

private AppContentIndexer? _indexer;

Check failure on line 68 in AIDevGallery/Samples/WCRAPIs/KnowledgeRetrieval.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-arm64

The type or namespace name 'AppContentIndexer' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in AIDevGallery/Samples/WCRAPIs/KnowledgeRetrieval.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-x64

The type or namespace name 'AppContentIndexer' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 68 in AIDevGallery/Samples/WCRAPIs/KnowledgeRetrieval.xaml.cs

View workflow job for this annotation

GitHub Actions / Unit Tests - win-x64

The type or namespace name 'AppContentIndexer' could not be found (are you missing a using directive or an assembly reference?)
private CancellationTokenSource? cts = new();

public KnowledgeRetrieval()
Expand Down Expand Up @@ -148,7 +148,7 @@
{
CancelResponse();
_model?.Dispose();
_indexer?.RemoveAll();
_indexer?.RemoveAllContentItems();
_indexer?.Dispose();
_indexer = null;
}
Expand Down Expand Up @@ -228,9 +228,8 @@
foreach (var match in textMatches)
{
Debug.WriteLine(match.ContentId);
if (match.ContentKind == QueryMatchContentKind.AppManagedText)
if (match is AppManagedTextQueryMatch textResult)
{
AppManagedTextQueryMatch textResult = (AppManagedTextQueryMatch)match;
string matchingData = simpleTextData[match.ContentId];
int offset = textResult.TextOffset;
int length = textResult.TextLength;
Expand Down Expand Up @@ -630,7 +629,7 @@
}

// Remove item from index
_indexer.Remove(id);
_indexer.RemoveContentItem(id);
}

private void IndexTextData(string id, string value)
Expand Down
19 changes: 10 additions & 9 deletions AIDevGallery/Samples/WCRAPIs/SemanticSearch.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media.Imaging;
using Microsoft.UI.Xaml.Navigation;
using Microsoft.Windows.AI.Search.Experimental.AppContentIndex;
using Microsoft.Windows.Search.AppContentIndex;

Check failure on line 11 in AIDevGallery/Samples/WCRAPIs/SemanticSearch.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-arm64

The type or namespace name 'Search' does not exist in the namespace 'Microsoft.Windows' (are you missing an assembly reference?)

Check failure on line 11 in AIDevGallery/Samples/WCRAPIs/SemanticSearch.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-x64

The type or namespace name 'Search' does not exist in the namespace 'Microsoft.Windows' (are you missing an assembly reference?)

Check failure on line 11 in AIDevGallery/Samples/WCRAPIs/SemanticSearch.xaml.cs

View workflow job for this annotation

GitHub Actions / Unit Tests - win-x64

The type or namespace name 'Search' does not exist in the namespace 'Microsoft.Windows' (are you missing an assembly reference?)
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
Expand Down Expand Up @@ -48,7 +48,7 @@
// This is some text data that we want to add to the index:
private Dictionary<string, string> simpleTextData = new Dictionary<string, string>
{
{ "item1", "Preparing a hearty vegetable stew begins with chopping fresh carrots, onions, and celery. Sauté them in olive oil until fragrant, then add diced tomatoes, herbs, and vegetable broth. Simmer gently for an hour, allowing flavors to meld into a comforting dish perfect for cold evenings." },
{ "item1", "Preparing a hearty vegetable stew begins with chopping fresh carrots, onions, and celery. Saut� them in olive oil until fragrant, then add diced tomatoes, herbs, and vegetable broth. Simmer gently for an hour, allowing flavors to meld into a comforting dish perfect for cold evenings." },
{ "item2", "Modern exhibition design combines narrative flow with spatial strategy. Lighting emphasizes focal objects while circulation paths avoid bottlenecks. Materials complement artifacts without visual competition. Interactive elements invite engagement but remain intuitive. Environmental controls protect sensitive works. Success balances scholarship, aesthetics, and visitor experience through thoughtful, cohesive design choices." },
{ "item3", "Domestic cats communicate through posture, tail flicks, and vocalizations. Play mimics hunting behaviors like stalking and pouncing, supporting agility and mental stimulation. Scratching maintains claws and marks territory, so provide sturdy posts. Balanced diets, hydration, and routine veterinary care sustain health. Safe retreats and vertical spaces reduce stress and encourage exploration." },
{ "item4", "Snowboarding across pristine slopes combines agility, balance, and speed. Riders carve smooth turns on powder, adjust stance for control, and master jumps in terrain parks. Essential gear includes boots, bindings, and helmets for safety. Embrace crisp alpine air while perfecting tricks and enjoying the thrill of winter adventure." },
Expand All @@ -62,7 +62,7 @@
{ "image3", "ms-appx:///Assets/ShakshukaRecipe.png" },
};

private AppContentIndexer? _indexer;

Check failure on line 65 in AIDevGallery/Samples/WCRAPIs/SemanticSearch.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-arm64

The type or namespace name 'AppContentIndexer' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 65 in AIDevGallery/Samples/WCRAPIs/SemanticSearch.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-x64

The type or namespace name 'AppContentIndexer' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 65 in AIDevGallery/Samples/WCRAPIs/SemanticSearch.xaml.cs

View workflow job for this annotation

GitHub Actions / Unit Tests - win-x64

The type or namespace name 'AppContentIndexer' could not be found (are you missing a using directive or an assembly reference?)
private CancellationTokenSource cts = new();

public SemanticSearch()
Expand Down Expand Up @@ -127,7 +127,7 @@

private void CleanUp()
{
_indexer?.RemoveAll();
_indexer?.RemoveAllContentItems();
_indexer?.Dispose();
_indexer = null;
}
Expand Down Expand Up @@ -271,15 +271,18 @@
foreach (var match in textMatches)
{
Debug.WriteLine(match.ContentId);
if (match.ContentKind == QueryMatchContentKind.AppManagedText)
if (match is AppManagedTextQueryMatch textResult)
{
AppManagedTextQueryMatch textResult = (AppManagedTextQueryMatch)match;
string matchingData = simpleTextData[match.ContentId];
int offset = textResult.TextOffset;
int length = textResult.TextLength;
string matchingString = matchingData.Substring(offset, length);
textResults += matchingString + "\n\n";
}
else if (match is AppManagedOcrTextQueryMatch ocrMatch)
{
textResults += ocrMatch.OcrText + "\n\n";
}
}

// Create text query
Expand All @@ -291,10 +294,8 @@
foreach (var match in imageMatches)
{
Debug.WriteLine(match.ContentId);
if (match.ContentKind == QueryMatchContentKind.AppManagedImage)
if (match is AppManagedImageQueryMatch imageResult)
{
AppManagedImageQueryMatch imageResult = (AppManagedImageQueryMatch)match;

if (simpleImageData.TryGetValue(imageResult.ContentId, out var imagePath))
{
imageResults.Add(imagePath);
Expand Down Expand Up @@ -467,7 +468,7 @@
}

// Remove item from index
_indexer.Remove(id);
_indexer.RemoveContentItem(id);
}

private void IndexTextData(string id, string value)
Expand Down Expand Up @@ -592,7 +593,7 @@
});
}

private void Listener_IndexCapabilitiesChanged(AppContentIndexer indexer, IndexCapabilities statusResult)

Check failure on line 596 in AIDevGallery/Samples/WCRAPIs/SemanticSearch.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-arm64

The type or namespace name 'IndexCapabilities' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 596 in AIDevGallery/Samples/WCRAPIs/SemanticSearch.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-arm64

The type or namespace name 'AppContentIndexer' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 596 in AIDevGallery/Samples/WCRAPIs/SemanticSearch.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-x64

The type or namespace name 'IndexCapabilities' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 596 in AIDevGallery/Samples/WCRAPIs/SemanticSearch.xaml.cs

View workflow job for this annotation

GitHub Actions / Build MSIX - win-x64

The type or namespace name 'AppContentIndexer' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 596 in AIDevGallery/Samples/WCRAPIs/SemanticSearch.xaml.cs

View workflow job for this annotation

GitHub Actions / Unit Tests - win-x64

The type or namespace name 'IndexCapabilities' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 596 in AIDevGallery/Samples/WCRAPIs/SemanticSearch.xaml.cs

View workflow job for this annotation

GitHub Actions / Unit Tests - win-x64

The type or namespace name 'AppContentIndexer' could not be found (are you missing a using directive or an assembly reference?)
{
LoadAppIndexCapabilities();
}
Expand Down
Loading