You are here

INSTALL.txt in Search API Solr 8

Installing Search API Solr Search
---------------------------------

The search_api_solr module manages its dependencies and class loader via
composer. So if you simply downloaded this module from drupal.org you have to
delete it and install it again via composer!

Simply change into Drupal directory and use composer to install search_api_solr:

cd $DRUPAL
composer require drupal/search_api_solr

Setting up Solr
---------------

In order for this module to work, you need to set up a Solr server.
For this, you can either purchase a server from a web Solr hosts or set up your
own Solr server on your web server (if you have the necessary rights to do so).
If you want to use a hosted solution, a number of companies are listed on the
module's project page [1]. Otherwise, please follow the instructions below.
A more detailed set of instructions is available at [2].

[1] https://drupal.org/project/search_api_solr
[2] https://drupal.org/node/1999310

As a pre-requisite for running your own Solr server, you'll need a Java JRE.

Download the latest version of Solr 4.x or 5.x or 6.x from [3] and unpack the
archive somewhere outside of your web server's document tree. The unpacked Solr
directory is named $SOLR in these instructions.

[3] http://www.apache.org/dyn/closer.cgi/lucene/solr/

For better performance and more features, 6.x should be used!
The support for 4.x and 5.x is deprecated and will be removed in 8.x-2.x.
The further instructions only cover Solr 5.x and 6.x on a UNIX-like operating
system.

First you have to create a Solr core for Drupal. Therefore you have to create
two directories (replace $SOLR and $CORE according to your needs):

mkdir $SOLR/server/solr/$CORE
mkdir $SOLR/server/solr/$CORE/conf

Before starting the Solr server you will have to make sure it uses the proper
configuration files. These are located in the solr-conf/ directory in this
module, in a sub-directory according to the Solr version you are using. Copy all
the files from that directory into Solr core's configuration directory:

cp -R $DRUPAL/modules/contrib/search_api_solr/solr_conf/$SOLR_VERSION/* $SOLR/server/solr/$CORE/conf

Afterwards, you have to tell SOLR about the new core by creating a
core.properties file:

echo "name=$CORE" > $SOLR/server/solr/$CORE/core.properties

Now you can start your Solr server:

$SOLR/bin/solr start

Afterwards, go to [4] in your web browser to ensure Solr is running correctly.

[4] http://localhost:8983/solr/#/$CORE

CAUTION! For production sites, it is vital that you somehow prevent outside
access to the Solr server. Otherwise, attackers could read, corrupt or delete
all your indexed data. Using the server as described below WON'T prevent this by
default! If it is available, the probably easiest way of preventing this is to
disable outside access to the ports used by Solr through your server's network
configuration or through the use of a firewall.
Other options include adding basic HTTP authentication or renaming the solr/
directory to a random string of characters and using that as the path.

Now you can go on and setup and configure the connection within your Drupal
installation.

File

INSTALL.txt
View source
  1. Installing Search API Solr Search
  2. ---------------------------------
  3. The search_api_solr module manages its dependencies and class loader via
  4. composer. So if you simply downloaded this module from drupal.org you have to
  5. delete it and install it again via composer!
  6. Simply change into Drupal directory and use composer to install search_api_solr:
  7. cd $DRUPAL
  8. composer require drupal/search_api_solr
  9. Setting up Solr
  10. ---------------
  11. In order for this module to work, you need to set up a Solr server.
  12. For this, you can either purchase a server from a web Solr hosts or set up your
  13. own Solr server on your web server (if you have the necessary rights to do so).
  14. If you want to use a hosted solution, a number of companies are listed on the
  15. module's project page [1]. Otherwise, please follow the instructions below.
  16. A more detailed set of instructions is available at [2].
  17. [1] https://drupal.org/project/search_api_solr
  18. [2] https://drupal.org/node/1999310
  19. As a pre-requisite for running your own Solr server, you'll need a Java JRE.
  20. Download the latest version of Solr 4.x or 5.x or 6.x from [3] and unpack the
  21. archive somewhere outside of your web server's document tree. The unpacked Solr
  22. directory is named $SOLR in these instructions.
  23. [3] http://www.apache.org/dyn/closer.cgi/lucene/solr/
  24. For better performance and more features, 6.x should be used!
  25. The support for 4.x and 5.x is deprecated and will be removed in 8.x-2.x.
  26. The further instructions only cover Solr 5.x and 6.x on a UNIX-like operating
  27. system.
  28. First you have to create a Solr core for Drupal. Therefore you have to create
  29. two directories (replace $SOLR and $CORE according to your needs):
  30. mkdir $SOLR/server/solr/$CORE
  31. mkdir $SOLR/server/solr/$CORE/conf
  32. Before starting the Solr server you will have to make sure it uses the proper
  33. configuration files. These are located in the solr-conf/ directory in this
  34. module, in a sub-directory according to the Solr version you are using. Copy all
  35. the files from that directory into Solr core's configuration directory:
  36. cp -R $DRUPAL/modules/contrib/search_api_solr/solr_conf/$SOLR_VERSION/* $SOLR/server/solr/$CORE/conf
  37. Afterwards, you have to tell SOLR about the new core by creating a
  38. core.properties file:
  39. echo "name=$CORE" > $SOLR/server/solr/$CORE/core.properties
  40. Now you can start your Solr server:
  41. $SOLR/bin/solr start
  42. Afterwards, go to [4] in your web browser to ensure Solr is running correctly.
  43. [4] http://localhost:8983/solr/#/$CORE
  44. CAUTION! For production sites, it is vital that you somehow prevent outside
  45. access to the Solr server. Otherwise, attackers could read, corrupt or delete
  46. all your indexed data. Using the server as described below WON'T prevent this by
  47. default! If it is available, the probably easiest way of preventing this is to
  48. disable outside access to the ports used by Solr through your server's network
  49. configuration or through the use of a firewall.
  50. Other options include adding basic HTTP authentication or renaming the solr/
  51. directory to a random string of characters and using that as the path.
  52. Now you can go on and setup and configure the connection within your Drupal
  53. installation.