Skip to content

Commit 05993ac

Browse files
committed
feat: general improvements and minor bugs
1 parent feab4f4 commit 05993ac

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

src/WebExpress.WebIndex/Queries/Query.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,33 @@ public IQuery<TIndexItem> WhereEquals(Expression<Func<TIndexItem, string>> selec
118118
return Where(Expression.Lambda<Func<TIndexItem, bool>>(body, param));
119119
}
120120

121+
/// <summary>
122+
/// Filters the query to include only items where the specified string property
123+
/// equals the given value.
124+
/// </summary>
125+
/// <param name="selector">
126+
/// An expression that selects the string property of the index item to compare.
127+
/// </param>
128+
/// <param name="value">
129+
/// The value to compare against the selected property. Can be null to match items
130+
/// with a null property value.
131+
/// </param>
132+
/// <returns>
133+
/// A query that returns items where the selected property equals the specified value.
134+
/// </returns>
135+
public IQuery<TIndexItem> WhereEquals(Expression<Func<TIndexItem, Guid>> selector, Guid value)
136+
{
137+
var param = selector.Parameters[0];
138+
139+
var body = Expression.Equal
140+
(
141+
selector.Body,
142+
Expression.Constant(value, typeof(Guid))
143+
);
144+
145+
return Where(Expression.Lambda<Func<TIndexItem, bool>>(body, param));
146+
}
147+
121148
/// <summary>
122149
/// Filters the query to include only items where the specified string property equals
123150
/// the given value, using a case-insensitive comparison.

0 commit comments

Comments
 (0)