README.txt 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. Solr search
  2. -----------
  3. This module provides an implementation of the Search API which uses an Apache
  4. Solr search server for indexing and searching. You can find detailed
  5. instructions for setting up Solr in the module's handbook [1].
  6. [1] https://www.drupal.org/node/1999280
  7. Supported optional features
  8. ---------------------------
  9. All Search API datatypes are supported by using appropriate Solr datatypes for
  10. indexing them. By default, "String"/"URI" and "Integer"/"Duration" are defined
  11. equivalently. However, through manual configuration of the used schema.xml this
  12. can be changed arbitrarily. Using your own Solr extensions is thereby also
  13. possible.
  14. The "direct" parse mode for queries will result in the keys being directly used
  15. as the query to Solr. For details about Lucene's query syntax, see [2]. There
  16. are also some Solr additions to this, listed at [3]. Note however that, by
  17. default, this module uses the dismax query handler, so searches like
  18. "field:value" won't work with the "direct" mode.
  19. [2] http://lucene.apache.org/java/2_9_1/queryparsersyntax.html
  20. [3] http://wiki.apache.org/solr/SolrQuerySyntax
  21. Regarding third-party features, the following are supported:
  22. - search_api_autocomplete
  23. Introduced by module: search_api_autocomplete
  24. Lets you add autocompletion capabilities to search forms on the site. (See
  25. also "Hidden variables" below for Solr-specific customization.)
  26. - search_api_facets
  27. Introduced by module: search_api_facetapi
  28. Allows you to create facetted searches for dynamically filtering search
  29. results.
  30. - search_api_facets_operator_or
  31. Introduced by module: search_api_facetapi
  32. Allows the creation of OR facets.
  33. - search_api_mlt
  34. Introduced by module: search_api_views
  35. Lets you display items that are similar to a given one. Use, e.g., to create
  36. a "More like this" block for node pages.
  37. NOTE: Due to a regression in Solr itself, "More like this" doesn't work with
  38. integer and float fields in Solr 4. As a work-around, you can index the fields
  39. (or copies of them) as string values. See [4] for details.
  40. Also, MLT with date fields isn't currently supported at all for any version.
  41. - search_api_multi
  42. Introduced by module: search_api_multi
  43. Allows you to search multiple indexes at once, as long as they are on the same
  44. server. You can use this to let users simultaneously search all content on the
  45. site – nodes, comments, user profiles, etc.
  46. - search_api_spellcheck
  47. Introduced by module: search_api_spellcheck
  48. Gives the option to display automatic spellchecking for searches.
  49. - search_api_data_type_location
  50. Introduced by module: search_api_location
  51. Lets you index, filter and sort on location fields. Note, however, that only
  52. single-valued fields are currently supported for Solr 3.x.
  53. - search_api_grouping
  54. Introduced by module: search_api_grouping [5]
  55. Lets you group search results based on indexed fields. For further information
  56. see the FieldCollapsing documentation in the solr wiki [6].
  57. If you feel some service option is missing, or have other ideas for improving
  58. this implementation, please file a feature request in the project's issue queue,
  59. at [7].
  60. [4] https://drupal.org/node/2004596
  61. [5] https://drupal.org/sandbox/daspeter/1783280
  62. [6] http://wiki.apache.org/solr/FieldCollapsing
  63. [7] https://drupal.org/project/issues/search_api_solr
  64. Specifics
  65. ---------
  66. Please consider that, since Solr handles tokenizing, stemming and other
  67. preprocessing tasks, activating any preprocessors in a search index' settings is
  68. usually not needed or even cumbersome. If you are adding an index to a Solr
  69. server you should therefore then disable all processors which handle such
  70. classic preprocessing tasks. Enabling the HTML filter can be useful, though, as
  71. the default config files included in this module don't handle stripping out HTML
  72. tags.
  73. Clean field identifiers:
  74. If your Solr server was created in a module version prior to 1.2, you will get
  75. the option to switch the server to "Clean field identifiers" (which is default
  76. for all new servers). This will change the Solr field names used for all
  77. fields whose Search API identifiers contain a colon (i.e., all nested fields)
  78. to support some advanced functionality, like sorting by distance, for which
  79. Solr is buggy when using field names with colons.
  80. The only downside of this change is that the data in Solr for these fields
  81. will become invalid, so all indexes on the server which contain such fields
  82. will be scheduled for re-indexing. (If you don't want to search on incomplete
  83. data until the re-indexing is finished, you can additionally manually clear
  84. the indexes, on their Status tabs, to prevent this.)
  85. Hidden variables
  86. ----------------
  87. - search_api_solr_autocomplete_max_occurrences (default: 0.9)
  88. By default, keywords that occur in more than 90% of results are ignored for
  89. autocomplete suggestions. This setting lets you modify that behaviour by
  90. providing your own ratio. Use 1 or greater to use all suggestions.
  91. - search_api_solr_index_prefix (default: '')
  92. By default, the index ID in the Solr server is the same as the index's machine
  93. name in Drupal. This setting will let you specify a prefix for the index IDs
  94. on this Drupal installation. Only use alphanumeric characters and underscores.
  95. Since changing the prefix makes the currently indexed data inaccessible, you
  96. should change this vairable only when no indexes are currently on any Solr
  97. servers.
  98. - search_api_solr_index_prefix_INDEX_ID (default: '')
  99. Same as above, but a per-index prefix. Use the index's machine name as
  100. INDEX_ID in the variable name. Per-index prefixing is done before the global
  101. prefix is added, so the global prefix will come first in the final name:
  102. (GLOBAL_PREFIX)(INDEX_PREFIX)(INDEX_ID)
  103. The same rules as above apply for setting the prefix.
  104. - search_api_solr_http_get_max_length (default: 4000)
  105. The maximum number of bytes that can be handled as an HTTP GET query when
  106. HTTP method is AUTO. Typically Solr can handle up to 65355 bytes, but Tomcat
  107. and Jetty will error at slightly less than 4096 bytes.
  108. - search_api_solr_cron_action (default: "spellcheck")
  109. The Search API Solr Search module can automatically execute some upkeep
  110. operations daily during cron runs. This variable determines what particular
  111. operation is carried out.
  112. - spellcheck: The "default" spellcheck dictionary used by Solr will be rebuilt
  113. so that spellchecking reflects the latest index state.
  114. - optimize: An "optimize" operation [8] is executed on the Solr server. As a
  115. result of this, all spellcheck dictionaries (that have "buildOnOptimize" set
  116. to "true") will be rebuilt, too.
  117. - none: No action is executed.
  118. If an unknown setting is encountered, it is interpreted as "none".
  119. - search_api_solr_site_hash (default: random)
  120. A unique hash specific to the local site, created the first time it is needed.
  121. Only change this if you want to display another server's results and you know
  122. what you are doing. Old indexed items will be lost when the hash is changed
  123. and all items will have to be reindexed. Can only contain alphanumeric
  124. characters.
  125. - search_api_solr_highlight_prefix (default: "tm_")
  126. The prefix of Solr fields for which field-level highlighting will be enabled.
  127. Since the prefix of fields is used to determine the field type (by default),
  128. this lets you enable highlighting for other field types. By default,
  129. highlighting will be possible for all fulltext fields.
  130. [8] http://wiki.apache.org/solr/UpdateXmlMessages#A.22commit.22_and_.22optimize.22
  131. Customizing your Solr server
  132. ----------------------------
  133. The schema.xml and solrconfig.xml files contain extensive comments on how to
  134. add additional features or modify behaviour, e.g., for adding a language-
  135. specific stemmer or a stopword list.
  136. If you are interested in further customizing your Solr server to your needs,
  137. see the Solr wiki at [9] for documentation. When editing the schema.xml and
  138. solrconfig.xml files, please only edit the copies in the Solr configuration
  139. directory, not directly the ones provided with this module.
  140. [9] http://wiki.apache.org/solr/
  141. You'll have to restart your Solr server after making such changes, for them to
  142. take effect.
  143. Developers
  144. ----------
  145. The SearchApiSolrService class has a few custom extensions, documented with its
  146. code. Methods of note are deleteItems(), which treats the first argument
  147. differently in certain cases, and the methods at the end of service.inc.