Is it possible to search for a part of a word? Ie if the query is "Foo" I can't figure out how to get a match on "BarFooBar" or "BarFoo". Something similar to .AnyWordBeginsWith("Foo") would be nice.
Looking at the documentation I would say that the FuzzyQuery would be able to find that for you. Did you try that one?
If I'm not misunderstanding thats the built in full text search in EPiServer Framework, not the product EPiServer Find.
Right you are! (guess I should read the question more carefully) ;)
How about the morelike then? http://find.episerver.com/Documentation/dotnet-api-more-like-related-documents
At the moment there's no "fluent API method" for wildcard queries in the Find .NET API. Below is an extension method that adds such functionality. It requires a query (string) and a field to apply the query to (an expression). By default it doesn't add any wildcard characters but the query type will parse "*" (any number of characters) and "?" (a single character). The reason it requires a field is that a wildcard query can be slow and therefor it's good to conciously make a decision about what field, or fields, to apply it to.
I'll see if I can create a more polished method later which I'll probably blog about if so.
public static class SearchExtensions
public static ITypeSearch<T> AddWildCardQuery<T>(
this ITypeSearch<T> search,
Expression<Func<T, string>> fieldSelector)
var fieldName = search.Client.Conventions.FieldNameConvention
var wildcardQuery = new WildcardQuery(fieldName, query.ToLowerInvariant());
return new Search<T, WildcardQuery>(search, context =>
if (context.RequestBody.Query != null)
var boolQuery = new BoolQuery();
boolQuery.MinimumNumberShouldMatch = 1;
context.RequestBody.Query = boolQuery;
context.RequestBody.Query = wildcardQuery;
var query = "Foo";
//Make it match any word containing foo
query = "*" + query + "*";
//Make it match any word ending with foo
//query = query + "*";
var result = client.Search<Recipe>()
.AddWildCardQuery(query, x => x.Name)
Use the method after having called the For or MoreLike methods but before any calls to Filter. Example:
var result = client.Search<Recipe>(Language.Swedish)
.InField(x => x.Name)
.InField(x => x.Instructions)
.AddWildCardQuery("*Foo*", x => x.Name)
.Filter(x => !x.ID.Match(42))
Again, keep in mind that wildcard queries, especially those starting with * or ? can be slow so use them only when it's really needed, preferably on a limited number of fields.