#community-help

Understanding Search Query's `facet_by` Implementation

TLDR Subas inquired about facet_by while making a search query and received clarifications from Jason. Issue not fully solved as further discussion is needed.

Powered by Struct AI
Oct 05, 2023 (2 months ago)
Subas
Photo of md5-bd905866847a616cbb29a92bc2198751
Subas
01:16 PM
Hi All, When i am making search query with facet_by then whatever facet_counts i am getting is based on per_page ? how i can get whole facets count for the search query. and if my response for search is like this
    "facet_counts": [
        {
            "counts": [
                {
                    "count": 8,
                    "highlighted": "eCommerce",
                    "value": "eCommerce"
                },
                {
                    "count": 2,
                    "highlighted": "Logistics and Supply Chain",
                    "value": "Logistics and Supply Chain"
                }
            ],
            "field_name": "industry_category",
            "sampled": false,
            "stats": {
                "total_values": 2
            }
        }
    ],

how i can get all 8 documents for eCommerce facets.............( I tried filter_by also but it is giving me different results. since eCommerce having 8 facets count but if i filter than i am getting more than 8 results .... ) can anyone help me out for this Thank you !
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
06:06 PM
whatever facet_counts i am getting is based on per_page ?
This is not the case.

Facets are always on the full resultset, unrelated to pagination
06:08
Jason
06:08 PM
Could you give me a snippet like this that replicates the issue you're seeing: https://gist.github.com/jasonbosco/7c3432713216c378472f13e72246f46b