I want to get filterd data on the basis of Tags

const getBlogPosts = async (page, pageSize, tags) => {
try {
const api = await Prismic.getApi("https://abc.cdn.prismic.io/api/v2");
const response = await api.query(
Prismic.Predicates.at('document.type', 'blogs'),
{
orderings: '[my.blogs.date desc]',
pageSize,
page,
// tags,
'my.blogs.tags': { any: tags }
}
);

  setBlogsDetail(response)
  setBlogs([...allBlogs, ...response.results])
  return response.results;
} catch (error) {
  console.error('Error fetching blog posts:', error);
  return [];
}

};
but i am getting "VM21094 index.js:69 Error fetching blog posts: Error: Unknown field tags"

Hi @nishant.tyagi ,

Welcome to the community :slight_smile:

So, there are a couple of things. I think you need to use the filter array to pass tags like seen in the docs here:

You must also ensure there are documents in your repo, or you'll always get errors.

Hello, @Phil I appreciate your response, but could you perhaps clarify how to use "filter" or "includes"?
Essentially, I would like to use a search filter in my website.
If I use filtler.any like this

    const tagss = await client.getAllByType('blogs', {
      filters: [
        prismic.filter.any(
          'document.tags',
          ['Customer Experience']
        ),
      ],
    })

then I have to send the exact value so that this produce the expected result but I want to get data by similiar data.

Your query looks correct, but on checking the repos connected to your email you have no published documents.

What repo are you trying to query?

What do you mean by?

Actually I want to use "filter" or "includes" for search filter in my website and I am getting some erors after use "includes".
I intend to implement a search filter mechanism by prismic API that return data closely matching the input provided in the search bar.

Building a search bar is not the use case for the filter or includes methods.

I would recommend integrating a dedicated search tool into your website project in place of this, such as: