lukaskolafa opened a new issue #247:
URL: https://github.com/apache/lucenenet/issues/247


   Hello, I am scratching my head, what is the purpose of the parameter `n` in 
the method `FacetsCollector.Search(..., n, ...)`. From various posts out there 
in internet (including java questions), it looks like the argument limits the 
results for Facets which deliver n+ hits. But this is not the behavior I 
observe, in my case, whatever number I use, the results is the same. Here is my 
code I use, based on the sample I found 
[here](https://github.com/apache/lucenenet/blob/master/src/Lucene.Net.Demo/Facet/SimpleFacetsExample.cs).
 
   
   One suspicious place in the code is that the return value of the `Search` 
method is not used. But this is the same case as in the referenced github 
sample.
   
   any help is appreciated.. thank you!
   
   ```
               BooleanQuery searchQuery = 
this.CreateLuceneSearchQuery(performCourseSearchRequest);
   
               var facetsCollector = new FacetsCollector();
   
               /*
                * This value should theoretically limit the result to return 
only facets with at least N results (hits). For some reason this
                * seems not being working and regardless what the number is, it 
returns always everything.
                */
               const int NumHitsLimit = 1;
   
               // Return value is not used, the searchQuery affects the 
referenced facetsCollector
               _ = 
FacetsCollector.Search(catalogSearchContainer.GetCurrentIndexSearcher(), 
searchQuery, NumHitsLimit, facetsCollector);
   
               var facets = new 
FastTaxonomyFacetCounts(catalogSearchContainer.GetCurrentTaxonomyReader(), 
FacetsConfigFactory.CreateFacetsConfig(), facetsCollector);
   
               foreach (var facetField in facetFields)
               {
                   FacetResult facetResult = 
facets.GetTopChildren(MaxFacetChildrenHits, facetField);
   
                   if (facetResult != null)
                   {
                       facetResults.Add(new FacetItem(facetResult));
                   }
               }
   
               return facetResults;
   ```
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to