README.txt 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. Search API Views integration
  2. ----------------------------
  3. This module integrates the Search API with the popular Views module [1],
  4. allowing users to create views with filters, arguments, sorts and fields based
  5. on any search index.
  6. [1] http://drupal.org/project/views
  7. "More like this" feature
  8. ------------------------
  9. This module defines the "More like this" feature (feature key: "search_api_mlt")
  10. that search service classes can implement. With a server supporting this, you
  11. can use the „More like this“ contextual filter to display a list of items
  12. related to a given item (usually, nodes similar to the node currently viewed).
  13. For developers:
  14. A service class that wants to support this feature has to check for a
  15. "search_api_mlt" option in the search() method. When present, it will be an
  16. array containing two keys:
  17. - id: The entity ID of the item to which related items should be searched.
  18. - fields: An array of indexed fields to use for testing the similarity of items.
  19. When these are present, the normal keywords should be ignored and the related
  20. items be returned as results instead. Sorting, filtering and range restriction
  21. should all work normally.
  22. "Random sort" feature
  23. ---------------------
  24. This module defines the "Random sort" feature (feature key:
  25. "search_api_random_sort") that allows to randomly sort the results returned by a
  26. search. With a server supporting this, you can use the "Global: Random" sort to
  27. sort the view's results randomly. Every time the query is run a different
  28. sorting will be provided.
  29. For developers:
  30. A service class that wants to support this feature has to check for a
  31. "search_api_random" field in the search query's sorts and insert a random sort
  32. in that position. If the query is sorted in this way, then the
  33. "search_api_random_sort" query option can contain additional options for the
  34. random sort, as an associative array with any of the following keys:
  35. - seed: A numeric seed value to use for the random sort.
  36. "BETWEEN operator" feature
  37. --------------------------
  38. This module defines the "BETWEEN operator" feature (feature key:
  39. "search_api_between") that adds the "BETWEEN" and "NOT BETWEEN" filter
  40. operators to search queries. If your search server supports this feature, you
  41. can use the "Is between" and "Is not between" operators when adding Views
  42. filters for numeric, string or date types.
  43. For developers:
  44. A service class that wants to support this feature has to accept "BETWEEN" and
  45. "NOT BETWEEN" as additional $operator values in query conditions. The value in
  46. both cases is an array with the keys 0 and 1, with the value under key 0 being
  47. the lower and the value under key 1 being the upper bound for the range in which
  48. the field's value should ("BETWEEN") or should not ("NOT BETWEEN") be.
  49. "Facets block" display
  50. ----------------------
  51. Most features should be clear to users of Views. However, the module also
  52. provides a new display type, "Facets block", that might need some explanation.
  53. This display type is only available, if the „Search facets“ module is also
  54. enabled.
  55. The basic use of the block is to provide a list of links to the most popular
  56. filter terms (i.e., the ones with the most results) for a certain category. For
  57. example, you could provide a block listing the most popular authors, or taxonomy
  58. terms, linking to searches for those, to provide some kind of landing page.
  59. Please note that, due to limitations in Views, this display mode is shown for
  60. views of all base tables, even though it only works for views based on Search
  61. API indexes. For views of other base tables, this will just print an error
  62. message.
  63. The display will also always ignore the view's "Style" setting, selected fields
  64. and sorts, etc.
  65. To use the display, specify the base path of the search you want to link to
  66. (this enables you to also link to searches that aren't based on Views) and the
  67. facet field to use (any indexed field can be used here, there needn't be a facet
  68. defined for it). You'll then have the block available in the blocks
  69. administration and can enable and move it at leisure.
  70. Note, however, that the facet in question has to be enabled for the search page
  71. linked to for the filter to have an effect.
  72. Since the block will trigger a search on pages where it is set to appear, you
  73. can also enable additional „normal“ facet blocks for that search, via the
  74. „Facets“ tab for the index. They will automatically also point to the same
  75. search that you specified for the display.
  76. If you want to use only the normal facets and not display anything at all in
  77. the Views block, just activate the display's „Hide block“ option.
  78. Note: If you want to display the block not only on a few pages, you should in
  79. any case take care that it isn't displayed on the search page, since that might
  80. confuse users.
  81. Access features
  82. ---------------
  83. Search views created with this module contain two query settings (located in
  84. the "Advanced" fieldset) which let you control the access checks executed for
  85. search results displayed in the view.
  86. - Bypass access checks
  87. This option allows you to deactivate access filters that would otherwise be
  88. added to the search, if the index supports this. This is, for instance, the case
  89. for indexes on the "Node" item type, when the "Node access" data alteration is
  90. activated.
  91. Use this either to slightly speed up searches where additional checks are
  92. unnecessary (e.g., because you already filter on "Node: Published") and there is
  93. no other node access mechanism on your site) or to show certain data that users
  94. normally wouldn't have access to (e.g., a list of all matching node titles,
  95. published or not).
  96. - Additional access checks on result entities
  97. When this option is activated, all result entities will be passed to an
  98. additional access check, even if search-time access checks are available for
  99. this index. The advantage is that access rules are guaranteed to be enforced –
  100. stale data in the index, which might make other access checks incorrect, won't
  101. influence this access check. You can also use it for item types for which no
  102. other access mechanisms are available.
  103. However, note that results filtered out this way will mess up paging, result
  104. counts and possibly other things too (like facet counts), as the result row is
  105. only hidden from display after the search has been executed. Where possible,
  106. you should therefore only use this in combination with appropriate filter
  107. settings ensuring that only when the index isn't up-to-date items will be
  108. filtered out this way.
  109. This option is only available for indexes on entity types.
  110. Other features
  111. --------------
  112. - Change parse mode
  113. You can determine how search keys entered by the user will be parsed by going to
  114. "Advanced" > "Query settings" within your View's settings. "Direct" can be
  115. useful, e.g., when you want to give users the full power of Solr. In other
  116. cases, "Multiple terms" is usually what you want / what users expect.
  117. Caution: For letting users use fulltext searches, always use the "Search:
  118. Fulltext search" filter or contextual filter – using a normal filter on a
  119. fulltext field won't parse the search keys, which means multiple words will only
  120. be found when they appear as that exact phrase.
  121. FAQ: Why „*Indexed* Node“?
  122. --------------------------
  123. The group name used for the search result itself (in fields, filters, etc.) is
  124. prefixed with „Indexed“ in order to be distinguishable from fields on referenced
  125. nodes (or other entities). The data displayed normally still comes from the
  126. entity, not from the search index.