How to Configure Apache Solr with Drupal
Install the Search API Solr module: Install the Search API Solr module in Drupal 9. This module provides integration between Drupal and Solr.
Create a Solr core: Create a Solr core for Drupal. You can do this using the Solr Admin interface or running a command in the terminal.
Configure the Search API Solr module: In Drupal, go to Configuration Search and Metadata Search API. Click on the "Add server" button to create a new Solr server. Fill in the server details and click on "Save".
Create a search index: Click on the "Add index" button to create a new search index. Select the Solr server you created in step 4 and fill in the index details.
Configure fields and filters: Add fields and filters to your search index. You can do this by going to the "Fields" and "Filters" tabs in the index settings.
Enable the Solr search page: Go to Configuration Search and Metadata Search Pages. Click on the "Add search page" button and fill in the details. Select the Solr index you created in step 5 and click on "Save".
Once you have completed the above steps, you should be able to use Apache Solr for search in Drupal 9.