我在查询 IEnumerable 计算索引字段时遇到问题。我正在使用 Sitecore 7.2 upd2、Lucene、ContentSearch 和 PredicateBuilder。
我正在尝试查询产品部分下提供的产品价格。有一些沉重的逻辑来寻找可用的产品,所以我决定将所有可用的产品价格放在计算字段中。不幸的是,我似乎无法使用 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.
有任何想法吗?