方面查詢最多返回100個項目


1

在SearchStax上將Sitecore 9.2與Solr一起使用。我們已將Query.MaxItems值修補為0,因此意外地發現返回的限制為100個項目。我們正在使用此代碼設置多個下拉菜單,以將值作為構面獲取:

var resultsFacets = repository.SearchByPredicate(query)
            .FacetOn(x => x.Schools, minCount)
            .Take(0)
            .GetResults();

此呼叫之後:

FacetCategory schools = resultsFacets.Facets.Categories.FirstOrDefault(a => a.Name.Equals("schools", StringComparison.OrdinalIgnoreCase));

還有一些其他代碼將其組合到下拉列表中,但是此搜索代碼返回的是值,然後又返回了100。所以我不知道為什麼我只能得到100個項目,如果還有另一個設置是否需要改寫,以免由於facet調用而繞過100個結果限制?

3

https://community.sitecore.net/developers/f/8/t/2367

Solr has a limit on the number of facets - which has nothing to do with the Query.MaxItems btw (that is for Sitecore queries). You should be able to set facet.limit to -1 to get all results.

Not sure if in the current implementation by Sitecore there is another solution possible already, but this was given at the community site answer mentioned above:

On your Solr Server, edit the solrconfig.xml for the index you are using. It is found in the conf folder of your index.

Find the requesthandler you are using, for instance "/select", and add -1. Be aware that you have to do this for each index that you want to update.

For me it looks like this after the fix:

<requestHandler name="/select" class="solr.SearchHandler"> 
<!-- default values for query parameters can be specified, these will be
overridden by parameters in the request --> 
<lst name="defaults"> 
<str name="echoParams">explicit</str> 
<int name="rows">10</int> 
<str name="df">text</str> 
<str name="facet.limit">-1</str> 
</lst>

One more blog with the same solution explained: https://blog.ryanbailey.co.nz/2018/07/sitecore-experience-commerce-facets-are.html