I have an index in dire need of some cleaning due to lack of free space.
I want to index only objects of a specific type with correct value on a property.
I have built an extension method for GenericMedia to filter if it is of a certain type:
public static bool IsBlue(this T content)
var iContent = content as IContent;
if (iContent != null)
SearchClient.Instance.Conventions.ForInstancesOf().IncludeField(x => x.IsBlue());
This property is used when filtering the search.
Since only a fraction of the indexed Generic Media objects actually have true value on on the property IsBlue, I see no reason to index those who do not.
How do I index only these blue objects?
I was thinking of something along these lines:
ContentIndexer.Instance.Conventions.ForInstancesOf().ShouldIndex(x => false);
ContentIndexer.Instance.Conventions.ForInstancesOf().Where(x => x.IsBlue()).ShouldIndex(x => true);
But, the syntax is all wrong. So, do any you know how to solve this problem?
Thanks for helping.
Does it work if you create an extension method like this:
public static class GenericMediaExtensions
public static bool IsBlue(this GenericMedia content)
// fancy logic
And then use this:
.ShouldIndex(x => x.IsBlue());
Great idea, I will try it and get back to you.