Universal search which searches for all the Posts and CPT

I am also looking for the universal search which searches for all the Posts, CPT, etc

if we get any working example that would be a great help.

Also, when I add my home page URL in the state.source.homepage to ‘/home’ then search does not work, it just adds the search term in URL and loads the home page. If I remove state.source.homepage then search works but shows only posts and not my home page.

@mburridge @juanma

1 Like

Hi @parth.nextbits,

Check this answer

Regarding this

Can you check the following?

If none of this work, can you please provide a repo or code-sandbox with your code? This is especially helpful to find solutions of technical issues with specific code

Thanks @juanma
I was able to create a custom page for search, as the default search not working as mentioned here Creating custom URLs for search results

Now, I would like to search through all Pages, CPT etc. as suggested by @mburridge I have installed this plugin too. but now in Frontity I have created below to get data of all CPT

const response = await libraries.source.api.get({
  endpoint: "multiple-post-type",
  params: { search: params.search, type[] : 'voice'}
});

Showing below error

As this does not allow to pass type[[ array as it was required by multiple-post-type plugin else getting below error in API

 {
	"code": "type_need_to_be_array",
	"message": "Type Param is a required parameter and needs to be an array:  &type[]=post&type[]=page&type[]=slideshow",
	"data": {
		"status": 422
	}
}

So, How can we achieve the same?

Hi @parth.nextbits,

Please, provide a repo or code-sandbox with your code. This is especially helpful to find solutions of technical issues with specific code

Probably old but I just ran into this article.
Just in case anyone would be seeing this and want a solution the code would be:

type: ['page', 'post']

@francis did you get a working solution for this? I’m floundering a bit with getting my multi-post-type search running.

Hi @parth.nextbits, where exactly have you added this code?

const response = await libraries.source.api.get({
  endpoint: "multiple-post-type",
  params: { search: params.search, type[] : 'voice'}
});

and why do you have : 'voice' after type[] ?

Could you please give more details? Thanks!