Background: Sitecore 8.2.6, SOLR 5.4.1
I need to use class indexer to resolve field name for SOLR.
To simplify issue description let me provide next code snippet:
var fieldName = ..method parameter.ToLowerInvariant();
var products = context.GetQueryable<SearchItemResult>()
.Where(x => x[fieldName] != null)
.ToList().AsEnumerable();
For example, fieldName value that is passed to predicate is "shape". Index actually contains field shape_s
.
The issue is such - when I use standard sitecore_web_index
, in Search.log I can observe query where this shape
is actually resolved to shape_s
, and query does its job. But when I switch to custom sitecore_products_index
which is based on web database and indexes just specific set of templates via <include hint="list:AddIncludedTemplate">
, in Search.log I get error message '["undefined field shape"]'.
As far as I can think after all my experiments the only superficial difference is that web index contains all the templates, but custom product index contains reduced set of them.
If I inherit SearchItemResult to my custom class and define some property decorated with IndexField attribute, everything works fine if I use this approach. But in this specific task I have to use dynamic field name passed as parameter, so I want to use C# indexer for a SearchItemResult class to resolve this into SOLR's field name.