How to get search results with highest relevance from multiple querys

Hello, I am trying to set up a property match search for a client where I can search for several pieces of information and get the results ordered by relevance. For example, say I have a list of properties like so:

1) name: Franchise1 - city: Miami - Highlights: Games, Soda, Pepsi
2) name: Franchise1 - city: Los Angeles - Highlights: Coffee, Games, Pizza
3) name: Franchise2 - city: Miami - Highlights: Tacos, Pepsi
4) name: Franchise2 - city: Orlando - Highlights: Burger, Fries, Soda

And I make a search for the following queries: “Franchise1” - “Los Angeles” - “Soda” - “Pizza”

Right now I know I can get a response like this:
(For query “Franchise1”) - 1, 2
(For query “Los Angeles”) - 2
(For query “Soda”) - 1, 4
(For query “Pizza”) - 2

However, I’d like to receive a results like
(For all queries) - 1, 2, 4

And also, if possible, since 2 has more matches than 1 cause it has name, city and one of the highlights whereas 1 only has name and one highlight, to have the results be ordered by relevance?

So final result would be something like this:
(For all queries) - 2, 1, 4

I think I can do this by saving the responses in several arrays and then matching the results, but if Algolia already has some search type or command that facilitates this for me without having to make a bunch of functions, then even better.

Just found something that does exactly this in another article :man_facepalming: sorry if I wasted anybody else’s time. (Article below)