You are here

README.txt in Search API Location 7.2

Same filename in this branch
  1. 7.2 README.txt
  2. 7.2 search_api_location_page/README.txt
  3. 7.2 search_api_location_views/README.txt
Same filename and directory in other branches
  1. 8 README.txt
Search API location
-------------------

This module adds support for indexing location values provided by the geofield
module and subsequently filtering and/or sorting on them, provided the service
class supports this.

Information for users
---------------------

This module adds a new data type, "Latitude/longitude" to the "Fields" form of
Search API indexes. You can use this to index the "LatLong Pair" property of
fields of type "geofield". (You will first have to add the field under "Add
related fields" at the bottom of the page.)

For this to have any effect, the service class of the index's server has to
support the search_api_data_type_location feature. Currently, only the Search
API Solr module [1] is known to support this feature. There is also a table at
[2] which lists all known features and which service classes support them, but
it might be out of date. When in doubt, consult the documentation of your
service class.

[1] http://drupal.org/project/search_api_solr
[2] http://drupal.org/node/1254698

To make real use of this module, and of data indexes as "Latitude/longitude",
you will need to install additional modules. Two of them are included in this
project: "Search API location views" and "Search API location pages". These add
location search capabilities to the "Search API views" and the "Search API
pages" module, respectively. Please refer to their own README.txt files for
details.

Information for developers
--------------------------

All provided hooks are listed in the search_api_location.api.php file.
Documentation on the CTools plugin defined by this module, location_input, is
also available there.

This module defines a feature, "search_api_data_type_location". By supporting
the feature with your service class, you indicate that you can index the
"location" data type in a useful manner. The data type is defined as a latitude
and longitude, in decimal degrees, separated by a comma, and has string format.
E.g., Dries' place of birth would be represented as: "51.16831,4.394287".

In addition to being able to index locations, you should also recognize the
"search_api_location" search query option, which is defined as follows:

The option is an array, where each value is an array that defines one set of
location data for the query and has the following structure:
- field: The Search API field identifier of the location field. Must be indexed
  as type "location".
- lat: The latitude of the point on which this location parameter is centered.
- lon: The longitude of that point.
- radius: (optional) If results should be filtered according to their distance
  to the point, the maximum distance at which a point should be included (in
  kilometers).
- method: (optional) The method to use for filtering. This is backend-specific
  and not guaranteed to have an effect. Service classes should ignore values of
  this option which they don't recognize.
- distance: (optional) If set to TRUE, the distance to the given point is
  returned in an additional field in the result. The name of the additional
  field consists of the location field's identifier and the suffix "_distance".
  Defaults to FALSE.
- bbox: (optional) A rectangle ("bounding box") for which to filter, ignoring
  "lat", "lon" and "distance". If present, "lat" and "lon" are optional, too. It
  is allowed to specify both a "bbox" and a "distance" filter. The rectangle is
  represented as an associative array containing exactly the following keys:
  - left
  - bottom
  - right
  - top
Even when no radius is set, service classes can choose to use the location data,
e.g., for sorting results or adapting facets on the field.

File

README.txt
View source
  1. Search API location
  2. -------------------
  3. This module adds support for indexing location values provided by the geofield
  4. module and subsequently filtering and/or sorting on them, provided the service
  5. class supports this.
  6. Information for users
  7. ---------------------
  8. This module adds a new data type, "Latitude/longitude" to the "Fields" form of
  9. Search API indexes. You can use this to index the "LatLong Pair" property of
  10. fields of type "geofield". (You will first have to add the field under "Add
  11. related fields" at the bottom of the page.)
  12. For this to have any effect, the service class of the index's server has to
  13. support the search_api_data_type_location feature. Currently, only the Search
  14. API Solr module [1] is known to support this feature. There is also a table at
  15. [2] which lists all known features and which service classes support them, but
  16. it might be out of date. When in doubt, consult the documentation of your
  17. service class.
  18. [1] http://drupal.org/project/search_api_solr
  19. [2] http://drupal.org/node/1254698
  20. To make real use of this module, and of data indexes as "Latitude/longitude",
  21. you will need to install additional modules. Two of them are included in this
  22. project: "Search API location views" and "Search API location pages". These add
  23. location search capabilities to the "Search API views" and the "Search API
  24. pages" module, respectively. Please refer to their own README.txt files for
  25. details.
  26. Information for developers
  27. --------------------------
  28. All provided hooks are listed in the search_api_location.api.php file.
  29. Documentation on the CTools plugin defined by this module, location_input, is
  30. also available there.
  31. This module defines a feature, "search_api_data_type_location". By supporting
  32. the feature with your service class, you indicate that you can index the
  33. "location" data type in a useful manner. The data type is defined as a latitude
  34. and longitude, in decimal degrees, separated by a comma, and has string format.
  35. E.g., Dries' place of birth would be represented as: "51.16831,4.394287".
  36. In addition to being able to index locations, you should also recognize the
  37. "search_api_location" search query option, which is defined as follows:
  38. The option is an array, where each value is an array that defines one set of
  39. location data for the query and has the following structure:
  40. - field: The Search API field identifier of the location field. Must be indexed
  41. as type "location".
  42. - lat: The latitude of the point on which this location parameter is centered.
  43. - lon: The longitude of that point.
  44. - radius: (optional) If results should be filtered according to their distance
  45. to the point, the maximum distance at which a point should be included (in
  46. kilometers).
  47. - method: (optional) The method to use for filtering. This is backend-specific
  48. and not guaranteed to have an effect. Service classes should ignore values of
  49. this option which they don't recognize.
  50. - distance: (optional) If set to TRUE, the distance to the given point is
  51. returned in an additional field in the result. The name of the additional
  52. field consists of the location field's identifier and the suffix "_distance".
  53. Defaults to FALSE.
  54. - bbox: (optional) A rectangle ("bounding box") for which to filter, ignoring
  55. "lat", "lon" and "distance". If present, "lat" and "lon" are optional, too. It
  56. is allowed to specify both a "bbox" and a "distance" filter. The rectangle is
  57. represented as an associative array containing exactly the following keys:
  58. - left
  59. - bottom
  60. - right
  61. - top
  62. Even when no radius is set, service classes can choose to use the location data,
  63. e.g., for sorting results or adapting facets on the field.