# Package com.ibm.openpages.api.search

Provides interfaces to work with the OpenPages Global Search, allowing for cross-object search against all data configured by administrators to be indexed for search.

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  ISearchResource | This interface represents the data returned from a Search for each search result instance.
  ISearchResults | A range of results provided by the Global Search, filtered by what the user has access to and presented as a List of ISearchResource objects.

- Class Summary
  Class | Description
  --- | ---
  DateFacetParam |
  SearchFacetOptions |
  SearchOptions | Search method options specifying what to search and how to retrieve results.
  UserFacetParam |

- Enum Summary
  Enum | Description
  --- | ---
  DateFacetParam.DateFacetAction | The 'A' value in: {!T A}[DATA] o = OnDate, r = RangeDate, p = PreviousDays, & n = NextDays
  DateFacetParam.DateFacetType | The 'T' value in: {!T A}[DATA] !c = CreationDate, !l = LastModifiedDate, & !o = OtherDates
  SearchMode | Enumeration for Global Search options.
  UserFacetParam.UserFacetAction | The 'A' value in: {!T A}[DATA] m = Me, & o = Others
  UserFacetParam.UserFacetType | The 'T' value in: {!T A}[DATA] !c = CreatedBy, !l = LastModifiedBy, & !o = NameOnObject

- Exception Summary
  Exception | Description
  --- | ---
  SearchException | OpenPages Global Search function related Exception; for Search ErrorCodes.

## Package com.ibm.openpages.api.search Description

Provides interfaces to work with the OpenPages Global Search, allowing for cross-object search against all data configured by administrators to be indexed for search. All searches are sent to the search server for handling the results and then returned based on the user's access rights.

Using search interfaces

Global Search can be accessed through `ISearchService` which has two public methods:
`isSearchReadyForUse()` which checks whether the state for Global Search is ready for searching and `search(String, SearchOptions)` which performs a search and gets the results.
Search methods return results using `ISearchResults` which is a container interface that has methods to find summary information about the search results. For example, the total search results and the actual range of results returned as `ISearchResource`.
ISearchResource is a light-weight interface for interacting with the search results, which will be GRC Objects. The interface provides access to read a subset of the System Fields for that Resource.

Administrative Settings that control Search

All Search behavior is controlled using registry settings under: '/ Platform / Search'. The settings that directly influence the search requests are in '/ Platform / Search / Request' (Note, some settings are hidden by default).

- Result Cache Size - limits the maximum number of search results that will be returned for any given search request. Also controls the size of server-side caching of search results per user.
- Search Page Size - A pair of values which control the "initial"|"additional" page sizes for requesting results from the search server. For the first attempt to query search server, the first number is used as the page size. For subsequent requests, the second number is used. Lower numbers result in faster search requests to be processed for user security; including Security Rules. If the processing success rate is likely to be low (e.g., for very restrictive Security Rules or narrow extend Security Rules), then higher numbers may be recommended to reduce the number of requests. Default value is "500|10000".
- Result Cache Refill Attempts - the number of retries that will be attempted if a request to the search server encounters an error.
- Search Timeout - the time in milliseconds that the search server is allowed to take to handle a search request and respond with results.
- Search Server URL - the URL to which search requests are sent.

Other Settings:

- / Platform / Search / Index / Language Analyzer - specifies the language analyzer used by the search server when building the index. For example, 'en' for English
- / Platform / Search / Solr User ID - the user id used to authenticate with the search server.
- / Platform / Search / Solr Password - the password used to authenticate with the search server.

In addition to the search related registry settings, all Object Types and Fields may be configured to be included in the Search Index or not. Any object type that is enabled for search will possibly be in the search results unless the SearchOptions explicitly identify the Ids for Object Types to be included. The Administrator can include or exclude specific Object Types from search globally in the Object Types administration page. For every record of an object in the Search index, all the fields on the Object type will be searched. The Administrator can include or exclude specific fields in the Field Groups administration page.

Search Exception and error messages

The ISearchService methods may throw `SearchException` if encountering any error or unexpected situation. The following table lists general errors and possible causes.

Error Code | Error | Possible Causes
--- | --- | ---
-24001 | Search is not enabled | Search feature is not enabled and/or Index not created
-24002 | Search request encountered an error. | General search error. Unexpected error from search server, failure to post-process search results
-24003 | Timeout | Search request timed out
-24004 | Search range is outside the bounds of the search results | Range out of bounds. Example: Range start exceeds the maximum result cache size value or total number of results
-24005 | Could not establish connection to the search engine | A connection could not be made to Search Server URL, check if Search Server service is stopped or Search Server URL setting is incorrect
-24006 | Search engine page not found | An HTTP 404 error from Search Server, check settings: Search Server URL or Query Path and that the Global Search index has been synchronized
-24007 | Invalid search terms provided | Search terms were blank

Since:
  7.2

Licensed Materials - Property of IBM
OpenPages with Watson (PID: 5725-D51)
© Copyright IBM Corporation 2013, 2021. All Rights Reserved.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.