Validating multiple locaiton using algolia search api

Dear Good People,

Here is my first post. I would look for your kind consideration and wise suggestion.

I am working on a web application where the user will input multiple location in the text box, I have to validate those with algolia,
what I am doing is, I have a database which contains the location information, including city, state, and country. I have already created an index in algolia using that information.
So when the user inputs multiple locations, in each line of a text area, I send that information to algolia using a loop and match with the first element of the response data (as there are so many data including the other matches).

I want to know if there is a way I could send all locations using an array and algolia would match those with the index and sent me a response that matched and which did not.

For example,
If I send (New York, Dallas, California, Test place) , Algolia would provide a response that “Test Place” is not a valid location after matching with my index.

In addition, I have another query, If user input locations like this, Dallas, tx or Dadeville, al (here tx is texas state and al is Alabama state) is there any way that alogolia can understand this matching with my index(in my index state is saved in full form). Or is there any way to create rules for short form in the algolia index.

Here is a sample of my code where I am comparing user input with algolia index(comparing only city)

       foreach($location as $row)
{
    if(!empty($row)){
        //sending each location to algolia index
        $objects = $index->search($row);
        
       //the top element of the response
        $place=$objects['hits'][0]['city'];
        
        //if location found in index
        if (strtolower($row)==strtolower($place)){
            $list['matched'][]= $row;
        }
        else{
            $list['notmatched'][]=$row;
        }
    }

I will be very happy to see your response. Please pardon me if there is any mistake in my post.

Hello @hriju.rahaman
You may want to take a look at this document:

You can send multiple queries in one request. So you send a batch of queries to see which input matches which.

For your second question, you can make additional attributes for the short forms and include them as searchableAttributes.

Let me know if the answers make sense or if you have any other question!