我遇到了查询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