Skip to content

Commit

Permalink
FIND-13264: Filter by enumerated properties
Browse files Browse the repository at this point in the history
- Remove incorrect function
  • Loading branch information
ManhOptimizely committed Oct 21, 2024
1 parent ec20618 commit e825a31
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 355 deletions.
314 changes: 0 additions & 314 deletions APIs/src/EpiServer.ContentGraph/Extensions/FilterExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,71 +71,6 @@ public static DelegateFilterBuilder Synonyms(this string field, params Synonyms[
{
return new DelegateFilterBuilder(field => new TermFilter(field, new StringFilterOperators().Synonym(values)));
}

public static DelegateFilterBuilder Boost(this IEnumerable<string> field, int value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new StringFilterOperators().Boost(value)));
}
public static DelegateFilterBuilder FieldExists(this IEnumerable<string> field, bool value = true)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new StringFilterOperators().Exists(value)));
}
/// <summary>
/// Full text search. Only use for <typeparamref name="Searchable"/> field.
/// </summary>
/// <param name="field"></param>
/// <param name="value"></param>
/// <returns>DelegateFilterBuilder</returns>
public static DelegateFilterBuilder Match(this IEnumerable<string> field, string value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new StringFilterOperators().Match(value)));
}
/// <summary>
/// Full text search. Only use for <typeparamref name="Searchable"/> field.
/// </summary>
/// <param name="field"></param>
/// <param name="value"></param>
/// <returns></returns>
public static DelegateFilterBuilder ContainsValue(this IEnumerable<string> field, string value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new StringFilterOperators().Contains(value)));
}
public static DelegateFilterBuilder Eq(this IEnumerable<string> field, string value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new StringFilterOperators().Eq(value)));
}
public static DelegateFilterBuilder NotEq(this IEnumerable<string> field, string value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new StringFilterOperators().NotEq(value)));
}
public static DelegateFilterBuilder NotIn(this IEnumerable<string> field, string[] values)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new StringFilterOperators().NotIn(values)));
}
public static DelegateFilterBuilder In(this IEnumerable<string> field, string[] values)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new StringFilterOperators().In(values)));
}
public static DelegateFilterBuilder Like(this IEnumerable<string> field, string value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new StringFilterOperators().Like(value)));
}
public static DelegateFilterBuilder MatchPrefix(this IEnumerable<string> field, string value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new StringFilterOperators().StartWith(value)));
}
public static DelegateFilterBuilder MatchSuffix(this IEnumerable<string> field, string value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new StringFilterOperators().EndWith(value)));
}
public static DelegateFilterBuilder MatchFuzzy(this IEnumerable<string> field, bool value = true)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new StringFilterOperators().Fuzzy(value)));
}
public static DelegateFilterBuilder Synonyms(this IEnumerable<string> field, params Synonyms[] values)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new StringFilterOperators().Synonym(values)));
}
#endregion

#region Date operator
Expand Down Expand Up @@ -201,46 +136,6 @@ public static DelegateFilterBuilder ModifiedIn(this object field, DateTime? from
return new TermFilter("_modified", dateOperator);
});
}

public static DelegateFilterBuilder Boost(this IEnumerable<DateTime> field, int value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new DateFilterOperators().Boost(value)));
}
/// <summary>
/// Range for datetime filter. The range is between greater than or equals [From] and less than [To].
/// </summary>
public static DelegateFilterBuilder InRange(this IEnumerable<DateTime> field, DateTime from, DateTime to)
{
return new DelegateFilterBuilder(field =>
new TermFilter(field, new DateFilterOperators()
.Gte(from.ToString("s") + "Z")
.Lt(to.ToString("s") + "Z")
));
}
public static DelegateFilterBuilder Eq(this IEnumerable<DateTime> field, DateTime value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new DateFilterOperators().Eq(value.ToString("s") + "Z")));
}
public static DelegateFilterBuilder NotEq(this IEnumerable<DateTime> field, DateTime value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new DateFilterOperators().NotEq(value.ToString("s") + "Z")));
}
public static DelegateFilterBuilder Gt(this IEnumerable<DateTime> field, DateTime value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new DateFilterOperators().Gt(value.ToString("s") + "Z")));
}
public static DelegateFilterBuilder Gte(this IEnumerable<DateTime> field, DateTime value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new DateFilterOperators().Gte(value.ToString("s") + "Z")));
}
public static DelegateFilterBuilder Lt(this IEnumerable<DateTime> field, DateTime value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new DateFilterOperators().Lt(value.ToString("s") + "Z")));
}
public static DelegateFilterBuilder Lte(this IEnumerable<DateTime> field, DateTime value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new DateFilterOperators().Lte(value.ToString("s") + "Z")));
}
#endregion

#region Numberic operator
Expand Down Expand Up @@ -293,54 +188,6 @@ public static DelegateFilterBuilder InRange(this int field, int from, int to)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().InRange(from,to)));
}
//IEnumerable
public static DelegateFilterBuilder Boost(this IEnumerable<int> field, int value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Boost(value)));
}
public static DelegateFilterBuilder FieldExists(this IEnumerable<int> field, bool value = true)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Exists(value)));
}
public static DelegateFilterBuilder Eq(this IEnumerable<int> field, int value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Eq(value)));
}
public static DelegateFilterBuilder NotEq(this IEnumerable<int> field, int value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().NotEq(value)));
}
public static DelegateFilterBuilder Gt(this IEnumerable<int> field, int value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Gt(value)));
}
public static DelegateFilterBuilder Gte(this IEnumerable<int> field, int value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Gte(value)));
}
public static DelegateFilterBuilder Lt(this IEnumerable<int> field, int value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Lt(value)));
}
public static DelegateFilterBuilder Lte(this IEnumerable<int> field, int value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Lte(value)));
}
public static DelegateFilterBuilder In(this IEnumerable<int> field, params int[] values)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().In(values)));
}
public static DelegateFilterBuilder NotIn(this IEnumerable<int> field, int[] values)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().NotIn(values)));
}
/// <summary>
/// Range filter for a field. The range is between greater than or equals [From] and less than or equals [To]
/// </summary>
public static DelegateFilterBuilder InRange(this IEnumerable<int> field, int from, int to)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().InRange(from, to)));
}
#endregion

#region Long type
Expand Down Expand Up @@ -391,54 +238,6 @@ public static DelegateFilterBuilder InRange(this long field, int from, int to)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().InRange(from, to)));
}

public static DelegateFilterBuilder Boost(this IEnumerable<long> field, int value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Boost(value)));
}
public static DelegateFilterBuilder FieldExists(this IEnumerable<long> field, bool value = true)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Exists(value)));
}
public static DelegateFilterBuilder Eq(this IEnumerable<long> field, int value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Eq(value)));
}
public static DelegateFilterBuilder NotEq(this IEnumerable<long> field, int value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().NotEq(value)));
}
public static DelegateFilterBuilder Gt(this IEnumerable<long> field, int value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Gt(value)));
}
public static DelegateFilterBuilder Gte(this IEnumerable<long> field, int value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Gte(value)));
}
public static DelegateFilterBuilder Lt(this IEnumerable<long> field, int value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Lt(value)));
}
public static DelegateFilterBuilder Lte(this IEnumerable<long> field, int value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Lte(value)));
}
public static DelegateFilterBuilder In(this IEnumerable<long> field, params int[] values)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().In(values)));
}
public static DelegateFilterBuilder NotIn(this IEnumerable<long> field, params int[] values)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().NotIn(values)));
}
/// <summary>
/// Range filter for a field. The range is between greater than or equals [From] and less than or equals [To]
/// </summary>
public static DelegateFilterBuilder InRange(this IEnumerable<long> field, int from, int to)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().InRange(from, to)));
}
#endregion

#region Float type
Expand Down Expand Up @@ -489,54 +288,6 @@ public static DelegateFilterBuilder InRange(this float field, int from, int to)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().InRange(from, to)));
}

public static DelegateFilterBuilder FieldExists(this IEnumerable<float> field, bool value = true)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Exists(value)));
}
public static DelegateFilterBuilder Boost(this IEnumerable<float> field, int value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Boost(value)));
}
public static DelegateFilterBuilder Eq(this IEnumerable<float> field, float value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Eq(value)));
}
public static DelegateFilterBuilder NotEq(this IEnumerable<float> field, float value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().NotEq(value)));
}
public static DelegateFilterBuilder Gt(this IEnumerable<float> field, float value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Gt(value)));
}
public static DelegateFilterBuilder Gte(this IEnumerable<float> field, float value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Gte(value)));
}
public static DelegateFilterBuilder Lt(this IEnumerable<float> field, float value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Lt(value)));
}
public static DelegateFilterBuilder Lte(this IEnumerable<float> field, float value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Lte(value)));
}
public static DelegateFilterBuilder In(this IEnumerable<float> field, params float[] values)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().In(values)));
}
public static DelegateFilterBuilder NotIn(this IEnumerable<float> field, float[] values)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().NotIn(values)));
}
/// <summary>
/// Range filter for a field. The range is between greater than or equals [From] and less than or equals [To]
/// </summary>
public static DelegateFilterBuilder InRange(this IEnumerable<float> field, int from, int to)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().InRange(from, to)));
}
#endregion

#region Double type
Expand Down Expand Up @@ -587,54 +338,6 @@ public static DelegateFilterBuilder InRange(this double field, int from, int to)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().InRange(from, to)));
}

public static DelegateFilterBuilder FieldExists(this IEnumerable<double> field, bool value = true)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Exists(value)));
}
public static DelegateFilterBuilder Boost(this IEnumerable<double> field, int value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Boost(value)));
}
public static DelegateFilterBuilder Eq(this IEnumerable<double> field, float value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Eq(value)));
}
public static DelegateFilterBuilder NotEq(this IEnumerable<double> field, float value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().NotEq(value)));
}
public static DelegateFilterBuilder Gt(this IEnumerable<double> field, float value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Gt(value)));
}
public static DelegateFilterBuilder Gte(this IEnumerable<double> field, float value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Gte(value)));
}
public static DelegateFilterBuilder Lt(this IEnumerable<double> field, float value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Lt(value)));
}
public static DelegateFilterBuilder Lte(this IEnumerable<double> field, float value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().Lte(value)));
}
public static DelegateFilterBuilder In(this IEnumerable<double> field, params float[] values)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().In(values)));
}
public static DelegateFilterBuilder NotIn(this IEnumerable<double> field, params float[] values)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().NotIn(values)));
}
/// <summary>
/// Range filter for a field. The range is between greater than or equals [From] and less than or equals [To]
/// </summary>
public static DelegateFilterBuilder InRange(this IEnumerable<double> field, int from, int to)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new NumericFilterOperators().InRange(from, to)));
}
#endregion

#endregion
Expand All @@ -656,23 +359,6 @@ public static DelegateFilterBuilder NotEq(this bool field, bool value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new BooleanFilterOperators().NotEq(value)));
}

public static DelegateFilterBuilder Boost(this IEnumerable<bool> field, int value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new BooleanFilterOperators().Boost(value)));
}
public static DelegateFilterBuilder FieldExists(this IEnumerable<bool> field, bool value = true)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new BooleanFilterOperators().Exists(value)));
}
public static DelegateFilterBuilder Eq(this IEnumerable<bool> field, bool value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new BooleanFilterOperators().Eq(value)));
}
public static DelegateFilterBuilder NotEq(this IEnumerable<bool> field, bool value)
{
return new DelegateFilterBuilder(field => new TermFilter(field, new BooleanFilterOperators().NotEq(value)));
}
#endregion
}
}
Loading

0 comments on commit e825a31

Please sign in to comment.