/AWS1/IF_SRD=>SUGGEST()¶
About Suggest¶
Retrieves autocomplete suggestions for a partial query string. You can use suggestions enable you to display likely matches before users finish typing. In Amazon CloudSearch, suggestions are based on the contents of a particular text field. When you request suggestions, Amazon CloudSearch finds all of the documents whose values in the suggester field start with the specified query string. The beginning of the field must match the query string to be considered a match.
For more information about configuring suggesters and retrieving suggestions, see Getting Suggestions in the Amazon CloudSearch Developer Guide.
The endpoint for submitting Suggest requests is domain-specific. You submit suggest requests to a domain's search endpoint. To get the search endpoint for your domain, use the Amazon CloudSearch configuration service DescribeDomains action. A domain's endpoints are also displayed on the domain dashboard in the Amazon CloudSearch console.
Method Signature¶
METHODS /AWS1/IF_SRD~SUGGEST
IMPORTING
!IV_QUERY TYPE /AWS1/SRDQUERY OPTIONAL
!IV_SUGGESTER TYPE /AWS1/SRDSUGGESTER OPTIONAL
!IV_SIZE TYPE /AWS1/SRDSUGGESTIONSSIZE OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_srdsuggestresponse
RAISING
/AWS1/CX_SRDSEARCHEXCEPTION
/AWS1/CX_SRDCLIENTEXC
/AWS1/CX_SRDSERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_query TYPE /AWS1/SRDQUERY /AWS1/SRDQUERY¶
Specifies the string for which you want to get suggestions.
iv_suggester TYPE /AWS1/SRDSUGGESTER /AWS1/SRDSUGGESTER¶
Specifies the name of the suggester to use to find suggested matches.
Optional arguments:¶
iv_size TYPE /AWS1/SRDSUGGESTIONSSIZE /AWS1/SRDSUGGESTIONSSIZE¶
Specifies the maximum number of suggestions to return.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_srdsuggestresponse /AWS1/CL_SRDSUGGESTRESPONSE¶
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->suggest(
iv_query = |string|
iv_size = 123
iv_suggester = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lo_suggeststatus = lo_result->get_status( ).
IF lo_suggeststatus IS NOT INITIAL.
lv_long = lo_suggeststatus->get_timems( ).
lv_string = lo_suggeststatus->get_rid( ).
ENDIF.
lo_suggestmodel = lo_result->get_suggest00( ).
IF lo_suggestmodel IS NOT INITIAL.
lv_string = lo_suggestmodel->get_query( ).
lv_long = lo_suggestmodel->get_found( ).
LOOP AT lo_suggestmodel->get_suggestions( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lv_string = lo_row_1->get_suggestion( ).
lv_long = lo_row_1->get_score( ).
lv_string = lo_row_1->get_id( ).
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.