README.txt 7.4 KB

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