November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
InField works for the "parent" object, in your example - Team:
clien.Search<Team>().For("my team name").InFiled(x => x.TeamName).Filter(x => x.PLayers, p => p.FirstName.Match("Christiano") & p.LastName.Match("Ronaldo")).GetResults();
Could you elaborate what are you trying to achieve?
I was hoping that one could use the inField on the object (not the parent object), for example something like this:
clien.Search<Team>().For("my team name").InFiled(x => x.Players[].FirstName).Filter(x => x.PLayers, p => p.FirstName.Match("Christiano") & p.LastName.Match("Ronaldo")).GetResults();
That is, i would like to search in a field of a nested object (or several fields, but not all). One reason for specifying infields is to exclude certain fields with data and to be able to use stemmings. Any work arounds that you can see?
Not 100% sure if I understand what you need to do, but have you tried using MatchContained?
var searchQuery = client.Search<BlogPost>() .Filter(x => x.Authors.MatchContained( a => a.Name, "Winston Churchill"));
Check out the documentation: http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Find/11/DotNET-Client-API/Searching/Filtering/Complex-objects/
I would like to use infield since it allows FIND to use stemmings. As I understand it, you must use infield to specify which field to search in order for stemming to work. And in my case the property that i would like to use with stemming is on the nested object. Ex
var searchQuery = client.Search<BlogPost>(Language.Swedish) .For(query) .InField(x.Authors.Name) .Filter(x => x.Authors.MatchContained( a => a.Name, "Winston Churchill"));
Oh, I see.
I think the easiest way to do that would be to add an extension, like this:
public static string Name(this List<Author> authors) { throw new NotImplementedException(); }
and then do:
.InField(x => x.Authors.Name())
That should do the trick.
Don't worry that the extension throws an exception. The Find engine will never actually invoke the extension method, but only look at it's name and type.
Hi!
Should it be possible to use infield together with nested queries? For example: