You are here

README.txt in Search API Solr 8

Same filename and directory in other branches
  1. 7 README.txt
Installation
------------

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

Solr search
-----------

This module provides an implementation of the Search API which uses an Apache
Solr search server for indexing and searching. Before enabling or using this
module, you'll have to follow the instructions given in INSTALL.txt first.

The minimum support version for Search API Solr Search 8.x is Solr 4.5.1.
Any version below might work if you use your own Solr config.
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.

For more detailed documentation, see the handbook [2].

[2] https://drupal.org/node/1999280

Supported optional features
---------------------------

All Search API datatypes are supported by using appropriate Solr datatypes for
indexing them. By default, "String"/"URI" and "Integer"/"Duration" are defined
equivalently. However, through manual configuration of the used schema.xml this
can be changed arbitrarily. Using your own Solr extensions is thereby also
possible.

The "direct" parse mode for queries will result in the keys being directly used
as the query to Solr. For details about Lucene's query syntax, see [3]. There
are also some Solr additions to this, listed at [4]. Note however that, by
default, this module uses the dismax query handler, so searches like
"field:value" won't work with the "direct" mode.

[3] http://lucene.apache.org/java/2_9_1/queryparsersyntax.html
[4] http://wiki.apache.org/solr/SolrQuerySyntax

Regarding third-party features, the following are supported:

- autocomplete
  Introduced by module: search_api_autocomplete
  Lets you add autocompletion capabilities to search forms on the site. (See
  also "Hidden variables" below for Solr-specific customization.)
- facets
  Introduced by module: facet
  Allows you to create facetted searches for dynamically filtering search
  results.
- more like this
  Introduced by module: search_api
  Lets you display items that are similar to a given one. Use, e.g., to create
  a "More like this" block for node pages build with Views.
- multisite
  Introduced by module: search_api_solr
- spellcheck
  Introduced by module: search_api_solr

If you feel some service option is missing, or have other ideas for improving
this implementation, please file a feature request in the project's issue queue,
at [5].

[5] https://drupal.org/project/issues/search_api_solr

Specifics
---------

Please consider that, since Solr handles tokenizing, stemming and other
preprocessing tasks, activating any preprocessors in a search index' settings is
usually not needed or even cumbersome. If you are adding an index to a Solr
server you should therefore then disable all processors which handle such
classic preprocessing tasks. Enabling the HTML filter can be useful, though, as
the default config files included in this module don't handle stripping out HTML
tags.

Hidden variables
----------------

- search_api_solr.settings.index_prefix (default: '')
  By default, the index ID in the Solr server is the same as the index's machine
  name in Drupal. This setting will let you specify a prefix for the index IDs
  on this Drupal installation. Only use alphanumeric characters and underscores.
  Since changing the prefix makes the currently indexed data inaccessible, you
  should change this vairable only when no indexes are currently on any Solr
  servers.
- search_api_solr.settings.index_prefix_INDEX_ID (default: '')
  Same as above, but a per-index prefix. Use the index's machine name as
  INDEX_ID in the variable name. Per-index prefixing is done before the global
  prefix is added, so the global prefix will come first in the final name:
  (GLOBAL_PREFIX)(INDEX_PREFIX)(INDEX_ID)
  The same rules as above apply for setting the prefix.
- search_api_solr.settings.cron_action (default: "spellcheck")
  The Search API Solr Search module can automatically execute some upkeep
  operations daily during cron runs. This variable determines what particular
  operation is carried out.
  - spellcheck: The "default" spellcheck dictionary used by Solr will be rebuilt
  so that spellchecking reflects the latest index state.
  - optimize: An "optimize" operation [9] is executed on the Solr server. As a
  result of this, all spellcheck dictionaries (that have "buildOnOptimize" set
  to "true") will be rebuilt, too.
  - none: No action is executed.
  If an unknown setting is encountered, it is interpreted as "none".
- search_api_solr.settings.site_hash (default: random)
  A unique hash specific to the local site, created the first time it is needed.
  Only change this if you want to display another server's results and you know
  what you are doing. Old indexed items will be lost when the hash is changed
  (without being automatically deleted from the Solr server!) and all items will
  have to be reindexed. Should only contain alphanumeric characters.

[9] http://wiki.apache.org/solr/UpdateXmlMessages#A.22commit.22_and_.22optimize.22

Connectors
----------

The communication details between Drupal and Solr is implemented by connectors.
This module includes the StandardSolrConnector and the BasicAuthSolrConnector.
There're service provider specific connectors available, for example from Acquia
and platform.sh. Pleas contact your provider for details if you don't run your
own Solr server.

Customizing your Solr server
----------------------------

The schema.xml and solrconfig.xml files contain extensive comments on how to
add additional features or modify behaviour, e.g., for adding a language-
specific stemmer or a stopword list.
But whenever you run a site that uses any language different than English or a
multi-lingual setup, we suggest that you don't modify the configurations by
yourself. Instead you should use the Search API Multilingual Solr Search
backend [10].
If you are interested in further customizing your Solr server to your needs,
see the Solr wiki at [11] for documentation. When editing the schema.xml and
solrconfig.xml files, please only edit the copies in the Solr configuration
directory, not directly the ones provided with this module.

[10] https://drupal.org/project/search_api_solr_multilingual
[11] http://wiki.apache.org/solr/

NOTE! You'll have to restart your Solr server after making such changes, for
them to take effect!

Troubleshooting Views
---------------------

When displaying search results from Solr in Views using the Search API Views
integration, make sure to *disable the Views cache*. By default the Solr search
index is updated asynchronously from Drupal, and this interferes with the Views
cache. Having the cache enabled will cause stale results to be shown, and new
content might not show up at all.

For most typical use cases the best results are achieved by disabling the Views
cache.

In case you really need caching (for example because you are showing some search
results on your front page) then you use the 'Search API (time based)' cache
plugin. This will make sure the cache is cleared at certain time intervals, so
your results will remain relevant. This can work well for views that have no
exposed filters and are set up by site administrators.

*Do not use the 'Search API (tag based)' cache!*
This is not compatible with default Solr setups.

Developers
----------

Whenever you need to enhance the functionality you should do it using the API
instead of extending the SearchApiSolrBackend class!
To customize connection-specific things you should provide your own
implementation of the \Drupal\search_api_solr\SolrBackendInterface.

Running the test suite
----------------------

This module comes with a suite of automated tests. To execute those, you just
need to have a (correctly configured) Solr instance running at the following
address:
  http://localhost:8983/solr/d8
(This represents a core named "d8" in a default installation of Solr.)

File

README.txt
View source
  1. Installation
  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. Solr search
  10. -----------
  11. This module provides an implementation of the Search API which uses an Apache
  12. Solr search server for indexing and searching. Before enabling or using this
  13. module, you'll have to follow the instructions given in INSTALL.txt first.
  14. The minimum support version for Search API Solr Search 8.x is Solr 4.5.1.
  15. Any version below might work if you use your own Solr config.
  16. For better performance and more features, 6.x should be used!
  17. The support for 4.x and 5.x is deprecated and will be removed in 8.x-2.x.
  18. For more detailed documentation, see the handbook [2].
  19. [2] https://drupal.org/node/1999280
  20. Supported optional features
  21. ---------------------------
  22. All Search API datatypes are supported by using appropriate Solr datatypes for
  23. indexing them. By default, "String"/"URI" and "Integer"/"Duration" are defined
  24. equivalently. However, through manual configuration of the used schema.xml this
  25. can be changed arbitrarily. Using your own Solr extensions is thereby also
  26. possible.
  27. The "direct" parse mode for queries will result in the keys being directly used
  28. as the query to Solr. For details about Lucene's query syntax, see [3]. There
  29. are also some Solr additions to this, listed at [4]. Note however that, by
  30. default, this module uses the dismax query handler, so searches like
  31. "field:value" won't work with the "direct" mode.
  32. [3] http://lucene.apache.org/java/2_9_1/queryparsersyntax.html
  33. [4] http://wiki.apache.org/solr/SolrQuerySyntax
  34. Regarding third-party features, the following are supported:
  35. - autocomplete
  36. Introduced by module: search_api_autocomplete
  37. Lets you add autocompletion capabilities to search forms on the site. (See
  38. also "Hidden variables" below for Solr-specific customization.)
  39. - facets
  40. Introduced by module: facet
  41. Allows you to create facetted searches for dynamically filtering search
  42. results.
  43. - more like this
  44. Introduced by module: search_api
  45. Lets you display items that are similar to a given one. Use, e.g., to create
  46. a "More like this" block for node pages build with Views.
  47. - multisite
  48. Introduced by module: search_api_solr
  49. - spellcheck
  50. Introduced by module: search_api_solr
  51. If you feel some service option is missing, or have other ideas for improving
  52. this implementation, please file a feature request in the project's issue queue,
  53. at [5].
  54. [5] https://drupal.org/project/issues/search_api_solr
  55. Specifics
  56. ---------
  57. Please consider that, since Solr handles tokenizing, stemming and other
  58. preprocessing tasks, activating any preprocessors in a search index' settings is
  59. usually not needed or even cumbersome. If you are adding an index to a Solr
  60. server you should therefore then disable all processors which handle such
  61. classic preprocessing tasks. Enabling the HTML filter can be useful, though, as
  62. the default config files included in this module don't handle stripping out HTML
  63. tags.
  64. Hidden variables
  65. ----------------
  66. - search_api_solr.settings.index_prefix (default: '')
  67. By default, the index ID in the Solr server is the same as the index's machine
  68. name in Drupal. This setting will let you specify a prefix for the index IDs
  69. on this Drupal installation. Only use alphanumeric characters and underscores.
  70. Since changing the prefix makes the currently indexed data inaccessible, you
  71. should change this vairable only when no indexes are currently on any Solr
  72. servers.
  73. - search_api_solr.settings.index_prefix_INDEX_ID (default: '')
  74. Same as above, but a per-index prefix. Use the index's machine name as
  75. INDEX_ID in the variable name. Per-index prefixing is done before the global
  76. prefix is added, so the global prefix will come first in the final name:
  77. (GLOBAL_PREFIX)(INDEX_PREFIX)(INDEX_ID)
  78. The same rules as above apply for setting the prefix.
  79. - search_api_solr.settings.cron_action (default: "spellcheck")
  80. The Search API Solr Search module can automatically execute some upkeep
  81. operations daily during cron runs. This variable determines what particular
  82. operation is carried out.
  83. - spellcheck: The "default" spellcheck dictionary used by Solr will be rebuilt
  84. so that spellchecking reflects the latest index state.
  85. - optimize: An "optimize" operation [9] is executed on the Solr server. As a
  86. result of this, all spellcheck dictionaries (that have "buildOnOptimize" set
  87. to "true") will be rebuilt, too.
  88. - none: No action is executed.
  89. If an unknown setting is encountered, it is interpreted as "none".
  90. - search_api_solr.settings.site_hash (default: random)
  91. A unique hash specific to the local site, created the first time it is needed.
  92. Only change this if you want to display another server's results and you know
  93. what you are doing. Old indexed items will be lost when the hash is changed
  94. (without being automatically deleted from the Solr server!) and all items will
  95. have to be reindexed. Should only contain alphanumeric characters.
  96. [9] http://wiki.apache.org/solr/UpdateXmlMessages#A.22commit.22_and_.22optimize.22
  97. Connectors
  98. ----------
  99. The communication details between Drupal and Solr is implemented by connectors.
  100. This module includes the StandardSolrConnector and the BasicAuthSolrConnector.
  101. There're service provider specific connectors available, for example from Acquia
  102. and platform.sh. Pleas contact your provider for details if you don't run your
  103. own Solr server.
  104. Customizing your Solr server
  105. ----------------------------
  106. The schema.xml and solrconfig.xml files contain extensive comments on how to
  107. add additional features or modify behaviour, e.g., for adding a language-
  108. specific stemmer or a stopword list.
  109. But whenever you run a site that uses any language different than English or a
  110. multi-lingual setup, we suggest that you don't modify the configurations by
  111. yourself. Instead you should use the Search API Multilingual Solr Search
  112. backend [10].
  113. If you are interested in further customizing your Solr server to your needs,
  114. see the Solr wiki at [11] for documentation. When editing the schema.xml and
  115. solrconfig.xml files, please only edit the copies in the Solr configuration
  116. directory, not directly the ones provided with this module.
  117. [10] https://drupal.org/project/search_api_solr_multilingual
  118. [11] http://wiki.apache.org/solr/
  119. NOTE! You'll have to restart your Solr server after making such changes, for
  120. them to take effect!
  121. Troubleshooting Views
  122. ---------------------
  123. When displaying search results from Solr in Views using the Search API Views
  124. integration, make sure to *disable the Views cache*. By default the Solr search
  125. index is updated asynchronously from Drupal, and this interferes with the Views
  126. cache. Having the cache enabled will cause stale results to be shown, and new
  127. content might not show up at all.
  128. For most typical use cases the best results are achieved by disabling the Views
  129. cache.
  130. In case you really need caching (for example because you are showing some search
  131. results on your front page) then you use the 'Search API (time based)' cache
  132. plugin. This will make sure the cache is cleared at certain time intervals, so
  133. your results will remain relevant. This can work well for views that have no
  134. exposed filters and are set up by site administrators.
  135. *Do not use the 'Search API (tag based)' cache!*
  136. This is not compatible with default Solr setups.
  137. Developers
  138. ----------
  139. Whenever you need to enhance the functionality you should do it using the API
  140. instead of extending the SearchApiSolrBackend class!
  141. To customize connection-specific things you should provide your own
  142. implementation of the \Drupal\search_api_solr\SolrBackendInterface.
  143. Running the test suite
  144. ----------------------
  145. This module comes with a suite of automated tests. To execute those, you just
  146. need to have a (correctly configured) Solr instance running at the following
  147. address:
  148. http://localhost:8983/solr/d8
  149. (This represents a core named "d8" in a default installation of Solr.)