Skip to content

Instantly share code, notes, and snippets.

@lindstromhenrik
Created April 4, 2017 10:23
Show Gist options
  • Save lindstromhenrik/2fae44c340a8c06a61b501025303ba56 to your computer and use it in GitHub Desktop.
Save lindstromhenrik/2fae44c340a8c06a61b501025303ba56 to your computer and use it in GitHub Desktop.
InAnalyzedField-extension
public static class QueryStringSearchExtensions {
public static IQueriedSearch<TSource, QueryStringQuery> InAnalyzedField<TSource, TExistingQuery>(
this IQueriedSearch<TSource, TExistingQuery> search,
Expression<Func<TSource, string>> fieldSelector,
double? relativeImportance = null)
where TExistingQuery : QueryStringQuery
{
fieldSelector.ValidateNotNullArgument("fieldSelector");
return search.InField(search.Client.Conventions.FieldNameConvention.GetFieldNameForAnalyzed((Expression)fieldSelector), relativeImportance);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment