Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法对int RavenDB的数组进行索引_C#_Indexing_Ravendb - Fatal编程技术网

C# 无法对int RavenDB的数组进行索引

C# 无法对int RavenDB的数组进行索引,c#,indexing,ravendb,C#,Indexing,Ravendb,我试图查询IEnumerable int类型的属性,以查找集合中包含此属性中的整数值的所有文档 我试图通过属性上的索引来实现这一点,以返回满足查询的id列表。我在查询中投影id,但是我得到了id 0的列表 索引 public class Merchants_CategoryId : AbstractIndexCreationTask<Merchant> { public class Result { public int MerchantId { ge

我试图查询IEnumerable int类型的属性,以查找集合中包含此属性中的整数值的所有文档

我试图通过属性上的索引来实现这一点,以返回满足查询的id列表。我在查询中投影id,但是我得到了id 0的列表

索引

public class Merchants_CategoryId : AbstractIndexCreationTask<Merchant>
{
    public class Result
    {
        public int MerchantId { get; set; }
        public IEnumerable<int> CategoryIds { get; set; }
    }

    public Merchants_CategoryId()
    {
        Map = merchants => merchants.Select(merchant => new
        {
            CategoryIds = merchant.Header.CategoryIds,
            MerchantId = merchant.Header.Id
        });
    }
}
公共类商户\u CategoryId:AbstractIndexCreationTask
{
公开课成绩
{
public int MerchantId{get;set;}
公共IEnumerable CategoryId{get;set;}
}
公共商户(类别)()
{
地图=商户=>商户。选择(商户=>新建)
{
CategoryIds=merchant.Header.CategoryIds,
MerchantId=merchant.Header.Id
});
}
}
查询

return await session
                .Query<Merchants_CategoryId.Result, Merchants_CategoryId>()
                .Where(x => x.CategoryIds.Any(c => c == categoryId))
                .Select(x => x.MerchantId)
                .ToListAsync();
返回等待会话
.Query()
其中(x=>x.categoryId.Any(c=>c==categoryId))
.选择(x=>x.MerchantId)
.ToListAsync();
索引:

public class Merchants_CategoryId : AbstractIndexCreationTask<Merchant>
{
      public class Result
      {
          public int MerchantId { get; set; }
          public int CategoryId { get; set; }
      }


      Map = merchants => from merchant in merchants
                         from categoryId in merchant.Header.CategoryIds
                         select new
                         {
                             MerchantId = merchant.Header.Id,
                             CategoryId = categoryId 
                         };

      Index(x => x.CategoryId, FieldIndexing.Yes);
      Store(x => x.MerchantId, FieldStorage.Yes);
}
公共类商户\u CategoryId:AbstractIndexCreationTask
{
公开课成绩
{
public int MerchantId{get;set;}
public int CategoryId{get;set;}
}
地图=商户=>来自商户中的商户
来自merchant.Header.categoryId中的categoryId
选择新的
{
MerchantId=merchant.Header.Id,
CategoryId=CategoryId
};
索引(x=>x.CategoryId,FieldIndexing.Yes);
商店(x=>x.MerchantId,FieldStorage.Yes);
}
查询:

return await session
            .Query<Merchants_CategoryId.Result, Merchants_CategoryId>()
            .Where(x => x.CategoryId == categoryId)
            .Select(x => x.MerchantId)
            .ToListAsync();
返回等待会话
.Query()
.其中(x=>x.CategoryId==CategoryId)
.选择(x=>x.MerchantId)
.ToListAsync();
索引:

public class Merchants_CategoryId : AbstractIndexCreationTask<Merchant>
{
      public class Result
      {
          public int MerchantId { get; set; }
          public int CategoryId { get; set; }
      }


      Map = merchants => from merchant in merchants
                         from categoryId in merchant.Header.CategoryIds
                         select new
                         {
                             MerchantId = merchant.Header.Id,
                             CategoryId = categoryId 
                         };

      Index(x => x.CategoryId, FieldIndexing.Yes);
      Store(x => x.MerchantId, FieldStorage.Yes);
}
公共类商户\u CategoryId:AbstractIndexCreationTask
{
公开课成绩
{
public int MerchantId{get;set;}
public int CategoryId{get;set;}
}
地图=商户=>来自商户中的商户
来自merchant.Header.categoryId中的categoryId
选择新的
{
MerchantId=merchant.Header.Id,
CategoryId=CategoryId
};
索引(x=>x.CategoryId,FieldIndexing.Yes);
商店(x=>x.MerchantId,FieldStorage.Yes);
}
查询:

return await session
            .Query<Merchants_CategoryId.Result, Merchants_CategoryId>()
            .Where(x => x.CategoryId == categoryId)
            .Select(x => x.MerchantId)
            .ToListAsync();
返回等待会话
.Query()
.其中(x=>x.CategoryId==CategoryId)
.选择(x=>x.MerchantId)
.ToListAsync();

这仍然返回0个商户id的列表。这仍然返回0个商户id的列表。