You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@sebastienros It seems that the reduce index is works only with property member not an object. Is there a way to create a reduce index where an object key?
For example, this
context.For<SearchQuerySummaryIndex, SomeKeyGroup>()
.When(searchQuery => searchQuery.Has<SearchQueryResultPart>())
.Map(searchQuery =>
{
var part = searchQuery.As<SearchQueryResultPart>();
if (part.ContentItemIds == null || !part.ContentItemIds.Any())
{
return null;
}
return part.ContentItemIds.Select(contentItemId => new SearchQuerySummaryIndex
{
ContentItemId = contentItemId,
Count = 1,
});
}).Group(x => new SomeKeyGroup {
ContentItemId = x.ContentItemId,
AnotherProperty = x.AnotherProperty,
})
.Reduce(group => new SearchQuerySummaryIndex
{
ContentItemId = group.Key.ContentItemId,
AnotherProperty = group.Key.AnotherProperty .
Count = group.Sum(p => p.Count)
})
.Delete((index, map) =>
{
index.Count -= map.Sum(p => p.Count);
// if Count == 0 then delete the index
return index.Count > 0 ? index : null;
});
throws the following exception
Group expression is not a valid member of:
The text was updated successfully, but these errors were encountered:
@sebastienros It seems that the reduce index is works only with property member not an object. Is there a way to create a reduce index where an object key?
For example, this
throws the following exception
The text was updated successfully, but these errors were encountered: