RavenDB - FullText搜索的索引创建,尝试投影字段

时间:2012-10-05 16:52:25

标签: c# ravendb projection

{   "BiImagePrefix": "bi",   "GrImagePrefix": "gr",   "FrameCount": 479,   "RollUid": null,   "Location": null,   "FrameList": [],  
> "Index": {
>     "DocumentType": "OFFICIAL RECORDS",
>     "RollNumber": "2865",
>     "RollTitle": ""   },   
>"IndexList": [
>>    {
>>>       "FrameNumber": 2,
>       "Index": {
>         "$type": "System.Dynamic.ExpandoObject, System.Core",
>         "Name": "2865",
>         "Title": "",
>         "Range": "2801-2900"
>       }
>     },
>>>     {
>>       "FrameNumber": 3,
      "Index": {
        "$type": "System.Dynamic.ExpandoObject, System.Core",
        "Name": "2865343",
        "Title": "",
        "Range": "233801-2943400"
      }
    }

  ]  }

创建以下索引

>     docs.Rolls
>     .SelectMany(roll => roll
>     .Select(token => new {__document_id = roll["@metadata"]["@id"], Name = token.Key,     Value = token.Value, Query = new
> {roll.Index.DocumentType,  roll.IndexList[0].FrameNumber,
> roll.IndexList[0].Index.Name}))
>     .Select(x => new {__document_id = x.__document_id, Name = x.Name, Value = x.Value, Query = x.Query})

投影字段

 1  __document_id   (Stored)
 2  Name    (Stored)
 3  Value     (Analyzed, Stored)
 4 Query    (Stored)

投影字段“查询”中的字段如果我这样引用就可以正常工作:

Query = new {roll.Index.DocumentType,  roll.IndexList[0].FrameNumber, roll.IndexList[0].Index.Name}

IndexList [0]仅投影第一个数组元素的所有字段。我想为“IndexList”数组中的所有元素(即所有FrameNumber)进行投影,我该如何指定。

我尝试了其中一个属性“FrameNumber”,它位于“IndexList”里面,就像这个roll.IndexList.Select(x=>x.FrameNumber)一样,并且它不起作用

我如何解决这个问题?

0 个答案:

没有答案