Fields of type string within a SearchParameter definition may be classified as either string or token. Unless these types are handled separately, queries must account for the differing storage mechanisms of both types, necessitating or queries and thereby impacting performance.
|
var plainStringQueries = new List<FilterDefinition<BsonDocument>>{ |
|
Builders<BsonDocument>.Filter.Type(parameterName, BsonType.String)}; |
|
return modifier == Modifier.NOT ? |
|
Builders<BsonDocument>.Filter.And(Builders<BsonDocument>.Filter.Not(arrayEqQuery), |
|
Builders<BsonDocument>.Filter.Not(noArrayEqQuery), Builders<BsonDocument>.Filter.Not(plainStringQuery)) |
|
: Builders<BsonDocument>.Filter.Or(arrayEqQuery, noArrayEqQuery, plainStringQuery); |
If the Map method accepts a SearchParamType parameter, the type can be evaluated during the ToExpressions phase:
if (searchParamType == SearchParamType.Token)
{
var values = new List<IndexValue>
{
new IndexValue("code", new StringValue(element.Value)),
};
return ListOf(new CompositeValue(values));
}
Fields of type
stringwithin aSearchParameterdefinition may be classified as eitherstringortoken. Unless these types are handled separately, queries must account for the differing storage mechanisms of both types, necessitatingorqueries and thereby impacting performance.spark/Libraries/Spark.Store.MongoDB/Search/CriteriaMongoExtensions.cs
Lines 352 to 353 in beb0c47
spark/Libraries/Spark.Store.MongoDB/Search/CriteriaMongoExtensions.cs
Lines 383 to 386 in beb0c47
If the
Mapmethod accepts aSearchParamTypeparameter, the type can be evaluated during theToExpressionsphase: