In a FAST search query I want to get all the refinements applicable to a search term. Currently I only get back 100 results. I want to know if there is a setting to get more than 100 refinement results which I have to pass in my query.
Here is the Refiners piece of the query:
<IncludeRefinementResults><Refiners><Refiner>*PROPERTY NAME*</Refiner></Refiners></IncludeRefinementResults>
I have already looked into Deep vs shallow Refiners (https://technet.microsoft.com/en-us/library/gg193929(v=office.14).aspx) that deals with refinements based on all results vs refinements based on just top 100 results and does not deal with the actual number for refinement results that are being returned.
It would be great if someone can point me to Microsoft documentation stating that 100 is the hard limit or guide me to the filter that I am missing.
Found this forum thread where it suggests that changing the refiner parameter "filter" should allow more than 100 results.
Add the managed property (Via Sharepoint UI), and mark it to be "Refiner property" and also to mark "Deep Refiner".
With the refiner parameter "filter" you can get the more than 100 refiners with this parameter.
You need to set this parameter along with your refiner property e.g.
author(filter=500)
After a ton of searching, I found a blog post with an answer. In short, the value is hard-coded, in the GetRefinableManagedPropertyInfos
method in the Microsoft.Office.Server.Search.RefinementUtilities.ManagedPropertyInfoProvider
class. The following is a long code snippet, but note the call to GetValuesForRefinableProperties
method with the value of 100
hard-coded into the maxItems
variable. I used Reflector to generate the following:
public IEnumerable<RefinableManagedPropertyInfo> GetRefinableManagedPropertyInfos(SiteCollectionReference siteCollectionReference, double percentageThreshold = 0.8, TermReference? termReference = new TermReference?())
{
using (new SPMonitoredScope("ManagedPropertyInfoProvider::GetRefinableManagedPropertyInfos"))
{
long num;
IEnumerable<Refinement> enumerable3;
IEnumerable<RefinerData> enumerable6;
IEnumerable<ManagedPropertyInfo> refinablePropertiesInSchema = this.GetAllRefinableProperties(siteCollectionReference).ToList<ManagedPropertyInfo>();
if (!termReference.HasValue)
{
ULS.SendTraceTag(0x153103, ULSCat.msoulscat_SEARCH_Admin, ULSTraceLevel.High, "ManagedPropertyInfoProvider::GetRefinableManagedPropertyInfos: Schema info only requested. Returning.", new object[] { "ManagedProperties" });
return CreateRefinableManagedPropertyInfoList(refinablePropertiesInSchema);
}
IEnumerable<string> source = (from r in refinablePropertiesInSchema select r.Name).ToList<string>();
if (!source.Contains<string>("ManagedProperties", StringComparer.OrdinalIgnoreCase))
{
ULS.SendTraceTag(0x153104, ULSCat.msoulscat_SEARCH_Admin, ULSTraceLevel.High, "ManagedPropertyInfoProvider::GetRefinableManagedPropertyInfos: Can not find managed property {0} in schema. Returning only refinable properties from schema.", new object[] { "ManagedProperties" });
return CreateRefinableManagedPropertyInfoList(refinablePropertiesInSchema);
}
try
{
enumerable3 = this.GetValuesForRefinableProperty(siteCollectionReference, "ManagedProperties", termReference.Value, 0x7fffffff, out num).ToList<Refinement>();
}
catch (QueryFailedException exception)
{
exception.RefinablePropertiesFromSchema = CreateRefinableManagedPropertyInfoList(refinablePropertiesInSchema);
throw;
}
if (num == 0L)
{
ULS.SendTraceTag(0x153105, ULSCat.msoulscat_SEARCH_Admin, ULSTraceLevel.High, "ManagedPropertyInfoProvider::GetRefinableManagedPropertyInfos: Query returned 0 results. Returning only refinable properties from schema.");
return CreateRefinableManagedPropertyInfoList(refinablePropertiesInSchema);
}
ULS.SendTraceTag(0x153106, ULSCat.msoulscat_SEARCH_Admin, ULSTraceLevel.Verbose, "ManagedPropertyInfoProvider::GetRefinableManagedPropertyInfos: Found {0} refinable properties with index values.", new object[] { enumerable3.Count<Refinement>() });
long threshold = (long) Math.Round((double) (num * percentageThreshold));
IEnumerable<string> enumerable4 = (from r in enumerable3
where r.RefinementCount >= threshold
select r.RefinementName).ToList<string>();
ULS.SendTraceTag(0x153107, ULSCat.msoulscat_SEARCH_Admin, ULSTraceLevel.Verbose, "ManagedPropertyInfoProvider::GetRefinableManagedPropertyInfos: Found {0} managed properties with values above threshold {1}", new object[] { enumerable4.Count<string>(), threshold });
IEnumerable<string> enumerable5 = source.Intersect<string>(enumerable4, StringComparer.OrdinalIgnoreCase).ToList<string>();
ULS.SendTraceTag(0x153108, ULSCat.msoulscat_SEARCH_Admin, ULSTraceLevel.Verbose, "ManagedPropertyInfoProvider::GetRefinableManagedPropertyInfos: Want to find entropy for {0} managed properties.", new object[] { enumerable5.Count<string>() });
try
{
enumerable6 = this.GetValuesForRefinableProperties(siteCollectionReference, enumerable5, termReference.Value, 100, out num).ToList<RefinerData>();
}
catch (QueryFailedException exception2)
{
exception2.RefinablePropertiesFromSchema = CreateRefinableManagedPropertyInfoList(refinablePropertiesInSchema);
throw;
}
ULS.SendTraceTag(0x153109, ULSCat.msoulscat_SEARCH_Admin, ULSTraceLevel.Verbose, "ManagedPropertyInfoProvider::GetRefinableManagedPropertyInfos: Total hits in entropy query = {0} Number of refiners returned = {1}", new object[] { num, enumerable6.Count<RefinerData>() });
return CreateRefinableManagedPropertyInfoList((from r in enumerable6
where r.Entropy > 0M
select r).ToDictionary<RefinerData, string, RefinerData>(suggestedRefiner => suggestedRefiner.RefinerName, r => r, StringComparer.OrdinalIgnoreCase), num, enumerable3, refinablePropertiesInSchema);
}
}
I haven't validated this by decompiling, changing the value, and recompiling, but unless Microsoft provides a patch, 100 seems to be a hard limit. The decompiled code above is current as of SharePoint 2013.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With