-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvements for Search Azure AI (#16127)
- Loading branch information
1 parent
d2260a0
commit 58149c4
Showing
26 changed files
with
338 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...OrchardCore/OrchardCore.Search.AzureAI.Core/Handlers/AzureAISearchFieldIndexEventsBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.Threading.Tasks; | ||
using OrchardCore.Search.AzureAI.Models; | ||
|
||
namespace OrchardCore.Search.AzureAI.Handlers; | ||
|
||
public class AzureAISearchFieldIndexEventsBase : IAzureAISearchFieldIndexEvents | ||
{ | ||
public virtual Task MappingAsync(SearchIndexDefinition context) | ||
=> Task.CompletedTask; | ||
|
||
public virtual Task MappedAsync(SearchIndexDefinition context) | ||
=> Task.CompletedTask; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...hardCore/OrchardCore.Search.AzureAI.Core/Handlers/DefaultAzureAISearchFieldIndexEvents.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System.Threading.Tasks; | ||
using OrchardCore.Contents.Indexing; | ||
using OrchardCore.Indexing; | ||
using OrchardCore.Search.AzureAI.Models; | ||
using OrchardCore.Search.AzureAI.Services; | ||
|
||
namespace OrchardCore.Search.AzureAI.Handlers; | ||
|
||
public sealed class DefaultAzureAISearchFieldIndexEvents : IAzureAISearchFieldIndexEvents | ||
{ | ||
public Task MappingAsync(SearchIndexDefinition context) | ||
{ | ||
if (context.IndexEntry.Type == DocumentIndex.Types.Text) | ||
{ | ||
context.Map.IsCollection = !context.IndexEntry.Options.HasFlag(DocumentIndexOptions.Keyword); | ||
context.Map.IsSearchable = true; | ||
} | ||
else | ||
{ | ||
context.Map.IsFilterable = true; | ||
context.Map.IsSortable = true; | ||
} | ||
|
||
return Task.CompletedTask; | ||
} | ||
|
||
public Task MappedAsync(SearchIndexDefinition context) | ||
{ | ||
if (context.Map.AzureFieldKey == AzureAISearchIndexManager.FullTextKey) | ||
{ | ||
context.Map.IsSearchable = true; | ||
context.Map.IsCollection = false; | ||
context.Map.IsSuggester = true; | ||
} | ||
else if (context.Map.AzureFieldKey == AzureAISearchIndexManager.DisplayTextAnalyzedKey) | ||
{ | ||
context.Map.IsSearchable = true; | ||
context.Map.IsCollection = false; | ||
} | ||
else if (context.Map.AzureFieldKey == IndexingConstants.ContentItemIdKey) | ||
{ | ||
context.Map.IsKey = true; | ||
context.Map.IsFilterable = true; | ||
context.Map.IsSortable = true; | ||
} | ||
else if (context.Map.AzureFieldKey == IndexingConstants.ContentItemVersionIdKey || | ||
context.Map.AzureFieldKey == IndexingConstants.OwnerKey) | ||
{ | ||
context.Map.IsFilterable = true; | ||
context.Map.IsSortable = true; | ||
} | ||
|
||
return Task.CompletedTask; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/OrchardCore/OrchardCore.Search.AzureAI.Core/IAzureAISearchFieldIndexEvents.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.Threading.Tasks; | ||
using OrchardCore.Search.AzureAI.Models; | ||
|
||
namespace OrchardCore.Search.AzureAI; | ||
|
||
public interface IAzureAISearchFieldIndexEvents | ||
{ | ||
Task MappingAsync(SearchIndexDefinition context); | ||
|
||
Task MappedAsync(SearchIndexDefinition context); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...I.Core/AzureAISearchIndexCreateContext.cs → ...Models/AzureAISearchIndexCreateContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
....Core/AzureAISearchIndexRebuildContext.cs → ...odels/AzureAISearchIndexRebuildContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...I.Core/AzureAISearchIndexRemoveContext.cs → ...Models/AzureAISearchIndexRemoveContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.