Skip to content

Commit

Permalink
RavenDB-7070 Throwing NotSupportedInCoraxException instead of NotSupp…
Browse files Browse the repository at this point in the history
…ortedException when unsupported feature is Corax specifc
  • Loading branch information
arekpalinski committed Sep 11, 2023
1 parent 94907cb commit d12a7d5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Globalization;
using Amazon.SimpleNotificationService.Model;
using Raven.Client.Documents.Indexes;
using Raven.Client.Exceptions.Corax;
using Raven.Server.Documents.Indexes.Persistence.Lucene.Documents;
using Sparrow.Json;
using Sparrow.Json.Parsing;
Expand Down Expand Up @@ -105,7 +106,7 @@ void HandleCompoundFields()
{
var fields = CompoundFields[i];
if (fields.Length != 2)
throw new NotSupportedException("Currently compound indexes are only supporting exactly 2 fields");
throw new NotSupportedInCoraxException("Currently compound indexes are only supporting exactly 2 fields");

var firstValueLen = AppendFieldValue(fields[0], 0);
var totalLen = AppendFieldValue(fields[1], firstValueLen);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected CoraxDocumentConverterBase(Index index, bool storeValue, bool indexImp
{
if (compoundField.Length != 2)
{
throw new NotSupportedException("CompoundField must have exactly 2 elements, but got: " + string.Join(",", compoundField));
throw new NotSupportedInCoraxException("CompoundField must have exactly 2 elements, but got: " + string.Join(",", compoundField));
}
}
}
Expand Down Expand Up @@ -359,7 +359,7 @@ protected void InsertRegularField<TBuilder>(IndexField field, object value, Json
builder.WriteNull(fieldId, path);
break;
case ValueType.BoostedValue:
throw new NotSupportedException("Boosting in index is not supported by Corax. You can do it during querying or change index type into Lucene.");
throw new NotSupportedInCoraxException("Boosting in index is not supported by Corax. You can do it during querying or change index type into Lucene.");
case ValueType.EmptyString:
builder.Write(fieldId, path, ReadOnlySpan<byte>.Empty);
break;
Expand All @@ -376,7 +376,7 @@ protected void InsertRegularField<TBuilder>(IndexField field, object value, Json
case ValueType.Stream:
throw new NotImplementedInCoraxException($"Streams are not implemented in Corax yet");
case ValueType.Lucene:
throw new NotSupportedException("The Lucene value type is not supported by Corax. You can change index type into Lucene.");
throw new NotSupportedInCoraxException("The Lucene value type is not supported by Corax. You can change index type into Lucene.");
default:
throw new NotSupportedException(valueType + " is not a supported type for indexing");
}
Expand Down Expand Up @@ -469,7 +469,7 @@ internal static void ThrowIndexingComplexObjectNotSupported(IndexField field, In
exceptionMessage =
$"The value of '{fieldName}' field is a complex object. Indexing it as a text isn't supported. You should consider querying on individual fields of that object.";
}
throw new NotSupportedException(exceptionMessage);
throw new NotSupportedInCoraxException(exceptionMessage);
}

public override void Dispose()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public Dictionary<string, Dictionary<string, string[]>> Execute(IndexQueryServer


if (tokensDictionary.TryGetValue(key, out var existingHighlights))
throw new NotSupportedException("Multiple highlightings for the same field and group key are not supported.");
throw new NotSupportedInCoraxException("Multiple highlightings for the same field and group key are not supported.");

tokensDictionary[key] = fragments.ToArray();
}
Expand Down Expand Up @@ -1270,9 +1270,9 @@ public override IEnumerable<BlittableJsonReaderObject> IndexEntries(IndexQuerySe
var position = query.Start;

if (query.Metadata.IsDistinct)
throw new NotSupportedException("We don't support Distinct in \"Show Raw Entry\" of Index.");
throw new NotSupportedInCoraxException("We don't support Distinct in \"Show Raw Entry\" of Index.");
if (query.Metadata.FilterScript != null)
throw new NotSupportedException(
throw new NotSupportedInCoraxException(
"Filter isn't supported in Raw Index View.");

var take = pageSize + position;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Corax.Queries.SortingMatches.Meta;
using Corax.Utils;
using Raven.Client.Exceptions;
using Raven.Client.Exceptions.Corax;
using Raven.Server.Documents.Indexes.Persistence.Corax.QueryOptimizer;
using Raven.Server.Documents.Queries;
using Raven.Server.Documents.Queries.AST;
Expand Down Expand Up @@ -1037,7 +1038,7 @@ private static IQueryMatch HandleSearch(Parameters builderParameters, MethodExpr

if (proximity.HasValue)
{
throw new NotSupportedException($"{nameof(Corax)} doesn't support proximity over search() method");
throw new NotSupportedInCoraxException($"{nameof(Corax)} doesn't support proximity over search() method");
}

CoraxConstants.Search.Operator @operator = CoraxConstants.Search.Operator.Or;
Expand Down Expand Up @@ -1359,7 +1360,7 @@ spatialField.Units is SpatialUnits.Kilometers
switch (orderingType)
{
case OrderByFieldType.Custom:
throw new NotSupportedException($"{nameof(Corax)} doesn't support Custom OrderBy.");
throw new NotSupportedInCoraxException($"{nameof(Corax)} doesn't support Custom OrderBy.");
case OrderByFieldType.AlphaNumeric:
sortArray[sortIndex++] = new OrderMetadata(metadataField, field.Ascending, MatchCompareFieldType.Alphanumeric);
continue;
Expand Down

0 comments on commit d12a7d5

Please sign in to comment.