How to add multiple indexes for fuse.js search

My code is available here: GitHub - navendu-pottekkat/ A static blog/portfolio website built using Hugo.

I’m using a theme that implements fuse.js for implementing client-side searching. We create an index file during build and fuse.js dynamically searches through this index when the site is running.

I have a layouts/_default/index.json file with the following content:

{{- $.Scratch.Add "index" slice -}}
{{- range .Site.RegularPages -}}
    {{- if and (not .Params.searchHidden) (ne .Layout `archives`) (ne .Layout `search`) (ne .Layout `about`) (ne .Layout `subscribe`) (ne .Layout `daily-theme`) }}
    {{- $.Scratch.Add "index" (dict "title" .Title "content" .Plain "permalink" .Permalink "summary" .Summary) -}}
    {{- end }}
{{- end -}}
{{- $.Scratch.Get "index" | jsonify -}}

I have modified it from the theme because I had different layouts/page types I did not want to be indexed in this search.

Now, I’m trying to create a new search bar that just searches for content with (ne .Layout daily-theme). So, I think, I can create a new index, something like layouts/_default/list.json and call it in fastsearch.js based on the page I’m in.

The problem is that, no matter what I do, I cannot seem to get fuse.js to look through the newly created index. I changed the name of the default index.json file and all its occurrences but still, it failed to load and add search to the site.

Is there a way where I can use fuse.js to use different indexes for search boxes on different pages? Are there any alternative solutions to achieve a similar end result?

I’m really bad at JS and everything on the front end. Sorry if this is a noob question.