RavenDB запрос ProjectFromIndexFieldsInto limit 15 результат - PullRequest
0 голосов
/ 27 июня 2018

У меня есть следующее определение индекса для акций

 public class GetStockListForCustomerIndex : AbstractIndexCreationTask<CustomerStock, GetStockListForCustomerIndex.Result>
{
    public GetStockListForCustomerIndex()
    {
        this.Map = docs => from d in docs

                           from i in d.Items
                           select new Result
                           {
                               Id = i.Id,
                               Country = d.Country,
                               CustomerNumber = d.CustomerNumber,
                               Type = d.Type,
                               ItemNumber = i.ItemNumber,
                               ItemName = i.ItemName,
                               ItemNameSortingField = i.ItemName,
                               UnitCost = i.UnitCost,
                               Quantity = i.Quantity,
                               ReservationDate = i.ReservationStartDate,
                               Threshold = i.Threshold,
                               AvailableQuantity = i.Available,
                               QuantityLeft = i.QuantityLeft,
                               Reserved = i.Reserved,
                               AlwaysOne = 1,
                               Currency = i.Currency
                           };

        this.Index(x => x.ItemNumber, FieldIndexing.Analyzed);

        this.Index(x => x.ItemName, FieldIndexing.Analyzed);

        this.Store(x => x.Id, FieldStorage.Yes);

        this.Store(x => x.Country, FieldStorage.Yes);

        this.Store(x => x.CustomerNumber, FieldStorage.Yes);

        this.Store(x => x.Type, FieldStorage.Yes);

        this.Store(x => x.ItemNumber, FieldStorage.Yes);

        this.Store(x => x.ItemName, FieldStorage.Yes);

        this.Store(x => x.ItemNameSortingField, FieldStorage.Yes);

        this.Store(x => x.UnitCost, FieldStorage.Yes);

        this.Store(x => x.Quantity, FieldStorage.Yes);

        this.Store(x => x.ReservationDate, FieldStorage.Yes);

        this.Store(x => x.Threshold, FieldStorage.Yes);

        this.Store(x => x.AvailableQuantity, FieldStorage.Yes);

        this.Store(x => x.QuantityLeft, FieldStorage.Yes);

        this.Store(x => x.Reserved, FieldStorage.Yes);

        this.Store(x => x.Currency, FieldStorage.Yes);
    }

    public class Result
    {
        public int Id { get; set; }

        public string Country { get; set; }

        public string CustomerNumber { get; set; }

        public string Type { get; set; }

        public string ItemNumber { get; set; }

        public string ItemName { get; set; }

        public string ItemNameSortingField { get; set; }

        public Threshold Threshold { get; set; }

        public int Quantity { get; set; }

        public int? AvailableQuantity { get; set; }

        public int? QuantityLeft { get; set; }

        public int? Reserved { get; set; }

        public decimal UnitCost { get; set; }

        public DateTime ReservationDate { get; set; }

        public int AlwaysOne { get; set; }

        public string Currency { get; set; }
    }
}

При выполнении следующего запроса:

  session.Query<Result>("GetStockListForCustomerIndex").Where(p =>p.CustomerNumber == "860016" && p.Type=="K3")
                        .ProjectFromIndexFieldsInto<Result>().ToList();

В результате будет возвращено 15 элементов, но документ содержит 26 элементов. Я использую Ravendb 3.5. Когда я тестирую тот же запрос, используя selectMany, я получаю правильный результат.

Правка кажется, что я всегда получаю максимум 15 элементов в результате

1 Ответ

0 голосов
/ 28 июня 2018

Используйте Raven/MaxSimpleIndexOutputsPerDocument для перенастройки предела по умолчанию 15.

Подробнее вы можете найти здесь: https://ravendb.net/docs/article-page/3.5/csharp/indexes/fanout-indexes

...