Skip to content

/AWS1/IF_IOS=>GETSEARCHRESULTS()

About GetSearchResults

Retrieves the ranked results of a search, ordered by descending relevance score. Results are available only after the search has reached the SUCCEEDED status. Calling this on a search that exists but has not yet completed returns InvalidRequestException, while calling it on a search that does not exist returns ResourceNotFoundException. The response is paginated: when nextToken is present, pass it on a subsequent call to retrieve the next page.

Method Signature

METHODS /AWS1/IF_IOS~GETSEARCHRESULTS
  IMPORTING
    !IV_SEARCHID TYPE /AWS1/IOSSEARCHID OPTIONAL
    !IV_WORKSPACENAME TYPE /AWS1/IOSWORKSPACENAME OPTIONAL
    !IV_MAXRESULTS TYPE /AWS1/IOSGETSRCHRSREQMAXRSINT OPTIONAL
    !IV_NEXTTOKEN TYPE /AWS1/IOSNEXTTOKEN OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_iosgetsearchrsltsrsp
  RAISING
    /AWS1/CX_IOSACCESSDENIEDEX
    /AWS1/CX_IOSINTERNALFAILUREEX
    /AWS1/CX_IOSINVALIDREQUESTEX
    /AWS1/CX_IOSRESOURCENOTFOUNDEX
    /AWS1/CX_IOSTHROTTLINGEX
    /AWS1/CX_IOSCLIENTEXC
    /AWS1/CX_IOSSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_searchid TYPE /AWS1/IOSSEARCHID /AWS1/IOSSEARCHID

The identifier of the search whose results are retrieved.

iv_workspacename TYPE /AWS1/IOSWORKSPACENAME /AWS1/IOSWORKSPACENAME

The name of the workspace the search belongs to.

Optional arguments:

iv_maxresults TYPE /AWS1/IOSGETSRCHRSREQMAXRSINT /AWS1/IOSGETSRCHRSREQMAXRSINT

The maximum number of results to return in a single page. Valid range is 1 to 10,000; if omitted, a service-defined default is used.

iv_nexttoken TYPE /AWS1/IOSNEXTTOKEN /AWS1/IOSNEXTTOKEN

The pagination token returned by a previous GetSearchResults call. Provide it to retrieve the next page of results; omit it to retrieve the first page.

RETURNING

oo_output TYPE REF TO /aws1/cl_iosgetsearchrsltsrsp /AWS1/CL_IOSGETSEARCHRSLTSRSP

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->getsearchresults(
  iv_maxresults = 123
  iv_nexttoken = |string|
  iv_searchid = |string|
  iv_workspacename = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  LOOP AT lo_result->get_searchresults( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_searchid = lo_row_1->get_searchid( ).
      lv_workspacename = lo_row_1->get_workspacename( ).
      lv_datasetid = lo_row_1->get_datasetid( ).
      lv_timeseriesid = lo_row_1->get_timeseriesid( ).
      lo_timeinnanos = lo_row_1->get_starttimestamp( ).
      IF lo_timeinnanos IS NOT INITIAL.
        lv_timeinseconds = lo_timeinnanos->get_timeinseconds( ).
        lv_offsetinnanos = lo_timeinnanos->get_offsetinnanos( ).
      ENDIF.
      lo_timeinnanos = lo_row_1->get_endtimestamp( ).
      IF lo_timeinnanos IS NOT INITIAL.
        lv_timeinseconds = lo_timeinnanos->get_timeinseconds( ).
        lv_offsetinnanos = lo_timeinnanos->get_offsetinnanos( ).
      ENDIF.
      lo_timeinnanos = lo_row_1->get_toptimestamp( ).
      IF lo_timeinnanos IS NOT INITIAL.
        lv_timeinseconds = lo_timeinnanos->get_timeinseconds( ).
        lv_offsetinnanos = lo_timeinnanos->get_offsetinnanos( ).
      ENDIF.
      lv_float = lo_row_1->get_score( ).
    ENDIF.
  ENDLOOP.
  lv_nexttoken = lo_result->get_nexttoken( ).
ENDIF.