Skip to content

Instantly share code, notes, and snippets.

@lindstromhenrik
Created April 24, 2013 11:10
Show Gist options
  • Save lindstromhenrik/5451390 to your computer and use it in GitHub Desktop.
Save lindstromhenrik/5451390 to your computer and use it in GitHub Desktop.
Extension for using FilterHits with BuildFilter()
public static ITypeSearch<TSource> FilterHits<TSource>(this ITypeSearch<TSource> search, Filter filter)
{
return new Search<TSource, IQuery>(search, context =>
{
var filterToAdd = filter;
if (context.RequestBody.Filter.IsNotNull())
{
filterToAdd = filter & context.RequestBody.Filter;
}
context.RequestBody.Filter = filterToAdd;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment