I have a pretty simple index that returns a flattened structure of Products and here is how I use it:
_documentSession.Query<ProductsIndex.IndexResult, ProductsIndex>().
Customize(x => x.WaitForNonStaleResults()).
OrderByDescending(x => x.DateTime).
Take(20).
AsProjection<ProductsIndex.IndexResult>().
ToList();
It works and returns 20 last results. Now I want to add a transformer to this query. Here is my try:
_documentSession.Query<ProductsIndex.IndexResult, ProductsIndex>().
Customize(x => x.WaitForNonStaleResults()).
TransformWith<ProductsTransformer, ProductsTransformer.TransformerResult>().
OrderByDescending(x => x.DateTime).
Take(20).
AsProjection<ProductsTransformer.TransformerResult>().
ToList();
So I added TransformWith line and changed AsProjection line. The problem is it returns only 8 documents. As I understand it doesn't get the AsProjection part and returns the Products themselves.