Skip to content

/AWS1/IF_LOC=>SEARCHPLACEINDEXFORTEXT()

About SearchPlaceIndexForText

This operation is no longer current and may be deprecated in the future. We recommend you upgrade to Geocode or SearchText unless you require Grab data.

  • SearchPlaceIndexForText is part of a previous Amazon Location Service Places API (version 1) which has been superseded by a more intuitive, powerful, and complete API (version 2).

  • The version 2 Geocode operation gives better results in the address geocoding use case, while the version 2 SearchText operation gives better results when searching for businesses and points of interest.

  • If you are using an Amazon Web Services SDK or the Amazon Web Services CLI, note that the Places API version 2 is found under geo-places or geo_places, not under location.

  • Since Grab is not yet fully supported in Places API version 2, we recommend you continue using API version 1 when using Grab.

Geocodes free-form text, such as an address, name, city, or region to allow you to search for Places or points of interest.

Optional parameters let you narrow your search results by bounding box or country, or bias your search toward a specific position on the globe.

You can search for places near a given position using BiasPosition, or filter results within a bounding box using FilterBBox. Providing both parameters simultaneously returns an error.

Search results are returned in order of highest to lowest relevance.

Method Signature

METHODS /AWS1/IF_LOC~SEARCHPLACEINDEXFORTEXT
  IMPORTING
    !IV_INDEXNAME TYPE /AWS1/LOCRESOURCENAME OPTIONAL
    !IV_TEXT TYPE /AWS1/LOCSENSITIVESTRING OPTIONAL
    !IT_BIASPOSITION TYPE /AWS1/CL_LOCPOSITION_W=>TT_POSITION OPTIONAL
    !IT_FILTERBBOX TYPE /AWS1/CL_LOCBOUNDINGBOX_W=>TT_BOUNDINGBOX OPTIONAL
    !IT_FILTERCOUNTRIES TYPE /AWS1/CL_LOCCOUNTRYCODELIST_W=>TT_COUNTRYCODELIST OPTIONAL
    !IV_MAXRESULTS TYPE /AWS1/LOCPLACEIDXSRCHRSLTLIMIT OPTIONAL
    !IV_LANGUAGE TYPE /AWS1/LOCLANGUAGETAG OPTIONAL
    !IT_FILTERCATEGORIES TYPE /AWS1/CL_LOCFILTPLACECATLIST_W=>TT_FILTERPLACECATEGORYLIST OPTIONAL
    !IV_KEY TYPE /AWS1/LOCAPIKEY OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_locsrchplaceidxfort01
  RAISING
    /AWS1/CX_LOCACCESSDENIEDEX
    /AWS1/CX_LOCINTERNALSERVEREX
    /AWS1/CX_LOCRESOURCENOTFOUNDEX
    /AWS1/CX_LOCTHROTTLINGEX
    /AWS1/CX_LOCVALIDATIONEX
    /AWS1/CX_LOCCLIENTEXC
    /AWS1/CX_LOCSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_indexname TYPE /AWS1/LOCRESOURCENAME /AWS1/LOCRESOURCENAME

The name of the place index resource you want to use for the search.

iv_text TYPE /AWS1/LOCSENSITIVESTRING /AWS1/LOCSENSITIVESTRING

The address, name, city, or region to be used in the search in free-form text format. For example, 123 Any Street.

Optional arguments:

it_biasposition TYPE /AWS1/CL_LOCPOSITION_W=>TT_POSITION TT_POSITION

An optional parameter that indicates a preference for places that are closer to a specified position.

If provided, this parameter must contain a pair of numbers. The first number represents the X coordinate, or longitude; the second number represents the Y coordinate, or latitude.

For example, [-123.1174, 49.2847] represents the position with longitude -123.1174 and latitude 49.2847.

BiasPosition and FilterBBox are mutually exclusive. Specifying both options results in an error.

it_filterbbox TYPE /AWS1/CL_LOCBOUNDINGBOX_W=>TT_BOUNDINGBOX TT_BOUNDINGBOX

An optional parameter that limits the search results by returning only places that are within the provided bounding box.

If provided, this parameter must contain a total of four consecutive numbers in two pairs. The first pair of numbers represents the X and Y coordinates (longitude and latitude, respectively) of the southwest corner of the bounding box; the second pair of numbers represents the X and Y coordinates (longitude and latitude, respectively) of the northeast corner of the bounding box.

For example, [-12.7935, -37.4835, -12.0684, -36.9542] represents a bounding box where the southwest corner has longitude -12.7935 and latitude -37.4835, and the northeast corner has longitude -12.0684 and latitude -36.9542.

FilterBBox and BiasPosition are mutually exclusive. Specifying both options results in an error.

it_filtercountries TYPE /AWS1/CL_LOCCOUNTRYCODELIST_W=>TT_COUNTRYCODELIST TT_COUNTRYCODELIST

An optional parameter that limits the search results by returning only places that are in a specified list of countries.

  • Valid values include ISO 3166 3-digit country codes. For example, Australia uses three upper-case characters: AUS.

iv_maxresults TYPE /AWS1/LOCPLACEIDXSRCHRSLTLIMIT /AWS1/LOCPLACEIDXSRCHRSLTLIMIT

An optional parameter. The maximum number of results returned per request.

The default: 50

iv_language TYPE /AWS1/LOCLANGUAGETAG /AWS1/LOCLANGUAGETAG

The preferred language used to return results. The value must be a valid BCP 47 language tag, for example, en for English.

This setting affects the languages used in the results, but not the results themselves. If no language is specified, or not supported for a particular result, the partner automatically chooses a language for the result.

For an example, we'll use the Greek language. You search for Athens, Greece, with the language parameter set to en. The result found will most likely be returned as Athens.

If you set the language parameter to el, for Greek, then the result found will more likely be returned as Αθήνα.

If the data provider does not have a value for Greek, the result will be in a language that the provider does support.

it_filtercategories TYPE /AWS1/CL_LOCFILTPLACECATLIST_W=>TT_FILTERPLACECATEGORYLIST TT_FILTERPLACECATEGORYLIST

A list of one or more Amazon Location categories to filter the returned places. If you include more than one category, the results will include results that match any of the categories listed.

For more information about using categories, including a list of Amazon Location categories, see Categories and filtering, in the Amazon Location Service developer guide.

iv_key TYPE /AWS1/LOCAPIKEY /AWS1/LOCAPIKEY

The optional API key to authorize the request.

RETURNING

oo_output TYPE REF TO /aws1/cl_locsrchplaceidxfort01 /AWS1/CL_LOCSRCHPLACEIDXFORT01

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->searchplaceindexfortext(
  it_biasposition = VALUE /aws1/cl_locposition_w=>tt_position(
    ( new /aws1/cl_locposition_w( |0.1| ) )
  )
  it_filterbbox = VALUE /aws1/cl_locboundingbox_w=>tt_boundingbox(
    ( new /aws1/cl_locboundingbox_w( |0.1| ) )
  )
  it_filtercategories = VALUE /aws1/cl_locfiltplacecatlist_w=>tt_filterplacecategorylist(
    ( new /aws1/cl_locfiltplacecatlist_w( |string| ) )
  )
  it_filtercountries = VALUE /aws1/cl_loccountrycodelist_w=>tt_countrycodelist(
    ( new /aws1/cl_loccountrycodelist_w( |string| ) )
  )
  iv_indexname = |string|
  iv_key = |string|
  iv_language = |string|
  iv_maxresults = 123
  iv_text = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lo_searchplaceindexfortext = lo_result->get_summary( ).
  IF lo_searchplaceindexfortext IS NOT INITIAL.
    lv_sensitivestring = lo_searchplaceindexfortext->get_text( ).
    LOOP AT lo_searchplaceindexfortext->get_biasposition( ) into lo_row.
      lo_row_1 = lo_row.
      IF lo_row_1 IS NOT INITIAL.
        lv_double = lo_row_1->get_value( ).
      ENDIF.
    ENDLOOP.
    LOOP AT lo_searchplaceindexfortext->get_filterbbox( ) into lo_row_2.
      lo_row_3 = lo_row_2.
      IF lo_row_3 IS NOT INITIAL.
        lv_double = lo_row_3->get_value( ).
      ENDIF.
    ENDLOOP.
    LOOP AT lo_searchplaceindexfortext->get_filtercountries( ) into lo_row_4.
      lo_row_5 = lo_row_4.
      IF lo_row_5 IS NOT INITIAL.
        lv_countrycode3 = lo_row_5->get_value( ).
      ENDIF.
    ENDLOOP.
    lv_placeindexsearchresultl = lo_searchplaceindexfortext->get_maxresults( ).
    LOOP AT lo_searchplaceindexfortext->get_resultbbox( ) into lo_row_2.
      lo_row_3 = lo_row_2.
      IF lo_row_3 IS NOT INITIAL.
        lv_double = lo_row_3->get_value( ).
      ENDIF.
    ENDLOOP.
    lv_string = lo_searchplaceindexfortext->get_datasource( ).
    lv_languagetag = lo_searchplaceindexfortext->get_language( ).
    LOOP AT lo_searchplaceindexfortext->get_filtercategories( ) into lo_row_6.
      lo_row_7 = lo_row_6.
      IF lo_row_7 IS NOT INITIAL.
        lv_placecategory = lo_row_7->get_value( ).
      ENDIF.
    ENDLOOP.
  ENDIF.
  LOOP AT lo_result->get_results( ) into lo_row_8.
    lo_row_9 = lo_row_8.
    IF lo_row_9 IS NOT INITIAL.
      lo_place = lo_row_9->get_place( ).
      IF lo_place IS NOT INITIAL.
        lv_sensitivestring = lo_place->get_label( ).
        lo_placegeometry = lo_place->get_geometry( ).
        IF lo_placegeometry IS NOT INITIAL.
          LOOP AT lo_placegeometry->get_point( ) into lo_row.
            lo_row_1 = lo_row.
            IF lo_row_1 IS NOT INITIAL.
              lv_double = lo_row_1->get_value( ).
            ENDIF.
          ENDLOOP.
        ENDIF.
        lv_sensitivestring = lo_place->get_addressnumber( ).
        lv_sensitivestring = lo_place->get_street( ).
        lv_sensitivestring = lo_place->get_neighborhood( ).
        lv_sensitivestring = lo_place->get_municipality( ).
        lv_sensitivestring = lo_place->get_subregion( ).
        lv_sensitivestring = lo_place->get_region( ).
        lv_sensitivestring = lo_place->get_country( ).
        lv_sensitivestring = lo_place->get_postalcode( ).
        lv_sensitiveboolean = lo_place->get_interpolated( ).
        lo_timezone = lo_place->get_timezone( ).
        IF lo_timezone IS NOT INITIAL.
          lv_sensitivestring = lo_timezone->get_name( ).
          lv_sensitiveinteger = lo_timezone->get_offset( ).
        ENDIF.
        lv_sensitivestring = lo_place->get_unittype( ).
        lv_sensitivestring = lo_place->get_unitnumber( ).
        LOOP AT lo_place->get_categories( ) into lo_row_10.
          lo_row_11 = lo_row_10.
          IF lo_row_11 IS NOT INITIAL.
            lv_placecategory = lo_row_11->get_value( ).
          ENDIF.
        ENDLOOP.
        LOOP AT lo_place->get_supplementalcategories( ) into lo_row_12.
          lo_row_13 = lo_row_12.
          IF lo_row_13 IS NOT INITIAL.
            lv_placesupplementalcatego = lo_row_13->get_value( ).
          ENDIF.
        ENDLOOP.
        lv_sensitivestring = lo_place->get_submunicipality( ).
      ENDIF.
      lv_sensitivedouble = lo_row_9->get_distance( ).
      lv_sensitivedouble = lo_row_9->get_relevance( ).
      lv_placeid = lo_row_9->get_placeid( ).
    ENDIF.
  ENDLOOP.
ENDIF.