Can't find TermsFacetFor overload with Size param

Johan Kronberg
Member since: 2005
 

I'm seeing in the docs for Find that TermsFacetFor has "... an overload that allows to specify the number of terms to return. If no size is specified the service defaults to ten."

I can't seem to find this overload and always get 10 terms back. What am I missing? Using EPi7 and the latest versions from NuGet.

#65216 Jan 23, 2013 11:28
  •  

    Hi,

    The overload doesn't explicitly take a size param but rather a delegate with which you can modify the "facet request". So, something like .TermsFacetFor(x => x.SomeProp, r => r.Size = 50) should work.

    #65218 Jan 23, 2013 12:03
  • Johan Kronberg
    Member since: 2005
     

    Not working straight off. Tried some different syntax takes but can't manage to have r into a TermsFacetRequest and set the Size prop. Would be great if I could get some code from a wet run. Thanks!

    #65264 Jan 24, 2013 12:00
  •  
    .TermsFacetFor(x => x.SearchSection, r => r.Size = 50)

    Works (cut-n-pasted from a project). Note that this is the TermsFacetFor call you do on the search/query. When you extract the facet, also using a method named TermsFacetFor, you don't need to, and can't specify size.

    If you can't get it to work, could you paste the (compilation) error?

     

     

    #65265 Jan 24, 2013 12:14
  • Johan Kronberg
    Member since: 2005
     

    Doh, of course it needs to be set before calling Find! I was on the TermsFacetFor() of the UnifiedSearchResult... Thanks!

    #65266 Jan 24, 2013 12:21