我遇到了查詢IEnumerable計算索引字段的問題。我使用Sitecore 7.2 upd2,Lucene,ContentSearch和PredicateBuilder。Sitecore內容搜索PredicateBuilder與IEnumerable
我想查詢產品的價格爲根據產品部分找到。有一些沉重的邏輯找到可用的產品,所以我決定把所有可用的產品價格放在計算領域。不幸的是,它看起來像我無法用PredicateBuilder查詢價格清單。
我的查詢看起來是這樣的:
predicate = predicate.And(p => p.Prices.Any(x => x >= priceFrom && x <= priceTo));
場配置指標配置:
<field fieldName="Prices" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.Collections.Generic.IEnumerable`1[System.Int32]" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider" />
這是我的錯誤:
Invalid Method Call Argument Type: Field - FieldNode - Field: prices - System.Collections.Generic.IEnumerable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]. Only constant arguments is supported.
什麼想法?
是的,這似乎是吧,我也想簡單的.Count中() - 沒有運氣。所以看起來我不能在IEnumerable上做任何簡單的操作。 – 2014-10-09 13:42:47
嗯..也許是任何()的實際調用,而不是我所說的Lambda。 – herskinduk 2014-10-09 14:39:27