RavenDB查询ProjectFromIndexFieldsInto限制15个结果

时间:2018-06-27 14:37:05

标签: c# ravendb

我对股票有以下指数定义

 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 :(得分:1)

使用std::move重新配置默认限制15。

您可以在此处找到更多详细信息:https://ravendb.net/docs/article-page/3.5/csharp/indexes/fanout-indexes