forked from ravendb/ravendb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RavenDB-23361 Added helper for determining search engine type
- Loading branch information
Showing
3 changed files
with
31 additions
and
12 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/Raven.Server/Documents/Indexes/Auto/IndexSearchEngineHelper.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,28 @@ | ||
using System.Linq; | ||
using Raven.Client.Documents.Indexes; | ||
using Raven.Server.Documents.Queries; | ||
|
||
namespace Raven.Server.Documents.Indexes.Auto; | ||
|
||
public static class IndexSearchEngineHelper | ||
{ | ||
public static SearchEngineType GetSearchEngineType(IndexQueryServerSide query, SearchEngineType defaultSearchEngineType) | ||
{ | ||
if (query.Metadata.HasVectorSearch) | ||
return SearchEngineType.Corax; | ||
|
||
return defaultSearchEngineType; | ||
} | ||
|
||
public static SearchEngineType GetSearchEngineType(Index index) | ||
{ | ||
return index.Type.IsAuto() switch | ||
{ | ||
// We only support Vectors in Corax, so if an auto-index is using it, let's already set it up as such, regardless | ||
// of what type of default storage engine is configured. | ||
true when index.Definition.IndexFields.Any(x=> x.Value.Vector != null) => SearchEngineType.Corax, | ||
true => index.Configuration.AutoIndexingEngineType, | ||
false => index.Configuration.StaticIndexingEngineType | ||
}; | ||
} | ||
} |
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