Sitecore.ContentSearch.SearchTypes.SearchResultItem Content属性始终为null

时间:2019-06-20 19:21:12

标签: indexing solr sitecore sitecore9

当我使用Sitecore.ContentSearch.Linq.GetResults()函数执行搜索时,似乎没有将Solr中的“ _content”字段与SearchResultItem的Content属性绑定在一起。这是我的代码如下:

using (var context = ContentSearchManager.GetIndex((SitecoreIndexableItem)Context.Item).CreateSearchContext())
        {
            var queryable = context.GetQueryable<SearchResult>();

            queryable = FilterOnLanguage(queryable);
            queryable = FilterOnVersion(queryable);
            queryable = FilterOnTemplate(queryable);
            queryable = FilterOnTags(queryable, tags);
            queryable = FilterOnCanIndex(queryable);
            queryable = FilterOnQuery(queryable, query); 

            queryable = queryable.FacetOn(p => p.Semantics);
            var results = queryable.GetResults();
            var facets = queryable.GetFacets();

            return results;
        }

在上面的FilterOnQuery函数中,我成功地通过Content字段进行了查询,并返回了结果:

            queryable = queryable.Filter(p =>
                p.Content.Like(query));

但是返回对象的Content字段始终为null。有什么想法吗?

0 个答案:

没有答案