c# - RavenDB 查询 ProjectFromIndexFieldsInto 限制 15 结果
问题描述
我对股票有以下指数定义
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 个项目的结果
解决方案
用于Raven/MaxSimpleIndexOutputsPerDocument
重新配置默认限制 15。
您可以在此处找到更多详细信息:https ://ravendb.net/docs/article-page/3.5/csharp/indexes/fanout-indexes
推荐阅读
- python-3.x - Noob Question How would I update a print a function's output without creating a new line in my term in python3?
- django - Django Rest 框架无法避免 Html 实体问题
- android - 在启动器应用程序抽屉中重新排列应用程序 android studio
- node.js - 如何摆脱包装无服务器离线 html 响应正文的双引号?
- sql - Angularjs - 以下代码插入重复记录的可能原因是什么?
- sql - 标量子查询中的子查询失败并出现错误 ORA-00936 缺少表达式
- kubernetes - Kubernetes 按活动连接数缩放 Pod
- kotlin - 将数字格式化为字符串,不足两个字符时填0
- python - 使用子进程运行单元测试时出现 ModuleNotFoundError
- c - 如何将程序代码放置在多个内存区域中?