If you can tag your filter query, you can exclude it when faceting. Your
results will honor the filter query and you will get the N results back,
and since faceting will exclude the filter, it will still give you facet
count for the base query.

https://lucene.apache.org/solr/guide/8_5/faceting.html#tagging-and-excluding-filters


On Mon, May 11, 2020 at 3:36 PM David Lukowski <david.lukow...@gmail.com>
wrote:

> I'm looking for a way if possible to run a query with random results, where
> I limit the number of results I want back, yet still have the facets
> accurately reflect the results I'm searching.
>
> When I run a search I use a filter query to randomize the results based on
> a modulo of a random seed. This returns a results set with the associated
> facets for each documentType.
>
> "response":{"numFound":377895,"start":0,"docs":[]
>   },
>   "facet_counts":{
>     "facet_queries":{},
>     "facet_fields":{
>       "documentType":[
>         "78",374015,
>         "3",3021,
>         "2",736,
>         "1",41,
>         "34",41,
>         "35",32,
>         "72",8,
>         "7",1]},
>
> How do I limit the number of results returned to N and have the facets
> accurately reflect the number of messages?  I cannot simply say rows=N
> because the facets will always reflect the total numFound and not the
> limited results set I'm looking for.
>

Reply via email to