Combine multipleQueries results

Apologies if this question has been asked already (I found this Q&A topic, but it didn’t help resolve my problem)

I have multiple input fields in my html form; let’s use a fictional ‘books’ index as an example. In my form, I have fields for author, genre, title and published year.

  • author: searchable attribute
  • genre: searchable attribute; facet
  • title: searchable attribute
  • yearPublished: searchable attribute; facet (numeric)

If I have a unique input field for each, how can I AND the query results from all of the fields? I can’t facet on author or genre because I want to search partial matches (so I would use ‘restrictSearchableAttributes’ instead of facets for these attributes); I can facet on year and genre easily enough, but I’m not sure how to combine all of these inputs into one AND search. The response from the code below returns a list of all the responses - how can I AND the results properly, so I only return results that fit all of the criteria?

const client = algoliasearch(APP_ID, API_KEY);

const queries = [{
  indexName: booksIndex,
  query: titleQuery, 
  params: {
    restrictSearchableAttributes: ['title'],              
    },
  }, {
  indexName: booksIndex,
  query: authorQuery, 
  params: {
     restrictSearchableAttributes: ['author'],              
     },
  }, {
  indexName: booksIndex,
  query: '', 
  params: {
    facetFilters: [`genre:${genre}`],              
    },
  }, {
  indexName: booksIndex,
  query: '', 
  params: {
    facetFilters: [`yearPublished:${year}`],              
    },
}];

client.multipleQueries(queries).then(results => {
   console.log('multiquery results:', results);
 });

Any suggestions?

Thanks for your time!