Steps
  1. install Solr locally
    1. check the Solr system requirements
    • SOLR comes completely sepparetely to Drupal and needs to be installed.

      The installation steps need to be performed up to the point when SOLR can be managed as a Linux service.

      SOLR files will be split into /opt/solr-$VERSION, some files in /etc/ and /var/solr/.

      You may need to add libraries to the /opt/solr-$VERSION/contrib folder. Check an existing installation of solr to know what libraries are needed. These may also go in the core folders as well, if different cores use different versions of libraries.

  2. add a solr core / search_api_solr server
    1. navigate to the search_api module admin UI and press "add server"
    2. select "Standard" as the solr connector
    3. leave everything as it is, and choose a NAME for the solr core at the "Solr core" field.
      • This core does NOT need to exist yet! It will be created later!
    4. save the server
    5. if you were not redirected there already, go to the new server's page (view tab, not edit tab) and download and extract the config.zip to any folder
      • remember the location of this folder and make sure it can be read for the following steps
    6. run "sudo -u $solr_user /opt/solr/bin/solr create_core -c $core_name -d $config_directory"
      • Some new versions of solr require "-n $core_name" at the end of the command, like solr 9.x

      • $solr_user is the user created by Apache Solr when it's installed. It should be "solr".

      • $core_name needs to be the same as the one that was set above, when creating the "server" in the Drupal admin UI.
      • $config_directory is the DIRECTORY path of the extracted config.zip. For some reason, selecting this directory to be used in creating the core only worked by cd-ing into it and using "." as the path.
      • The original command found in the README.MD of the search_api_solr module is the following.

        $ sudo -u solr /opt/solr/bin/solr create_core -c test-core -d /tmp/solr-conf -n test-core

        If when using --help, the "-n" flag isn't even listed, you don't need it, as it was added only in later versions.

    7. copy all of the config files from the exported and unzipped config.zip to the $core_path/conf folder
      • $core_path is the path to the search core, NOT to the solr install folder.

        Usually this will be similar to

        /var/solr/data/$core_name/conf

        and NOT

        /opt/solr-9.3.0/...
      • if you still get issues, spam the exported config files all over the place until something works, idk, there's no centralised documentation for where the hell these are supposed to go.

        If you don't want to do this you'll have to search for all of the file locations individually in the Apache Solr documentation.

    • This step is just an increible pain, but it boils down to:

      1. Copy the config to the core data folder
      2. Create the core in any way, even through the UI (the UI doesn't actually configure anything, it just adds what you type into the UI...)
      3. Restart solr service
      4. Reload the core in drupal

      It should work after and if it doesn't good luck bro. It all sounds incredibly easy until you sit down to do it.

  3. add and configure an index
    • You will need to select all the fields that you want to be displayed in the content at all (so even things that you need for filtering, not just displaying). Be wary of choosing the string vs the fulltext field type for titles and other short texts, as the "string" field type is not searchable. You can always add an integer and a fulltext index field based on the same content field, though.

      This one should be straight-forward besides one thing: if you get a generic error in the admin UI when selecting a datasource, that leads to a 500 error in the debug console that was caused by ajax, which doesn't make the slightest sense, you need to reinstall search_api (working down through the dependencies).

      When I did this, I could not uninstall search_api_solr because search_api_solr_autocomplete needed it, even though the autocomplete module wasn't even installed. To fix this, you have to

      1. backup everything
      2. go to $webroot/update.php
      3. while navigating the forms you should get warnings related to the search modules having entries in the database even though they are uninstalled that you will have to find in the database manually and remove

      You should be able to reinstall the search modules afterwards, but try a clear cache as well if not.

  4. create and configure a view that displays the newly configured index
    • You can not edit an existing view for this as the bundle to be displayed can not be changed after creation.

      Maybe try editing the view config .yml file and importing if you NEED to keep the same view, but I have not tried that myself.