As the title say it, I am facing problem while creating filter dropdown option to the search result page, the resulted data is coming from blog post to the page. I am using Hubspot CRM Search API that gives the metadata like (total, start-index, pagination etc) and array of total 10 detailed data that includes (post title, publish date, author name and it’s details). Only that 10 data I can map through and render to the page and add pagination and If I apply filter logic then the outcomes from this filter coming from that array (only 10 data) and not from the whole blog post data. Do anyone known how to fix this issues.
page link: https://blog.unnanu.com/hs-search-results?&q=ai
Hey @sachin_gowda - thanks for posting in the Community!
I’d like to tag in some Community experts to see if they have any context here that may help us out! @Ben_M, @franksteiner79, and @CateDuarte - any insight?
Shane, Senior Community Moderator
It looks like you’re applying the filter to the 10 results returned by the API, which is why it’s not filtering across all blog posts. I’d suggest handling the filtering at the API level instead of using JavaScript’s .filter() on the current results. You can use limit and offset for pagination and make a fresh API request whenever the dropdown value changes.
However, if you’re filtering by author, publish date, or tags, HubSpot’s Site Search API has some limitations, so you might need a different approach. Could you share which API endpoint you’re using and what fields you’re trying to filter by?
I hope this helps you out. Please mark it as Solution Accepted and Like to help another Community member.
Thanks!