
On application UIs there is often a search box where users can enter a free text search string. How this kind of search string is used to find adequate results has to be handled by the application. The custom query option search is intended exactly for passing such a free-text search term to the backend and let the backend decide against which properties of each entity in the entity set the term is matched, and in what way. It may also be matched against properties of related entities.
GET ~/Orders?search=blue End of the example.
SAP Gateway offers OpenSearch capabilities for your service implementation. The search term is in parameter IV_SEARCH_STRING of method GET_ENTITYSET of interface /IWBEP/IF_MGW_APPL_SRV_RUNTIME.
The annotation sap:searchable=”true” can be added to an entity set. With this annotation the framework tells the client that it can use the custom query option search.
Note that search works just like $filter: it will return a subset of the entities that are returned when no search term is specified. And it combines with $filter in that only entities that fulfill both conditions are returned.
OpenSearch can be used to tell an OpenSearch client how it can construct URLs with search.
If an entity set in Service Builder has been create based on a search help there is at present no code generated that supports search. This has to be done manually by the developer.
/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/TravelagencyCollection/OpenSearchDescription.xml
/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/TravelagencyCollection?search=Germany