To perform a basic search, you can specify a deep link to the SearchListPortlet from a JSP page. The URL for the portlet must either pass a simple set of request parameters that specify the search criteria, or pass a JSON-formatted query string. A basic search defines a single search criterion, such as the following:
First Name starts with A
To launch a search, you can call the single portlet render url for the SearchListPortlet. You must pass the request parameter MODE=MODE_RESULTS_LIST
You can pass a simple set of request parameters to the SearchListPortlet. These parameters specify an entity, an attribute to search on, an operator, and a search string. The following script shows the URL for the portlet, as well as the four request parameters you need to use:
<script type="text/javascript">function openSearchResults(extraUrlParams) { var url = "/IDMProv/portal/portlet/SearchListPortlet?"; url += "urlType=Render&novl-regid=SearchListPortlet"; url += "&novl-inst=IDMProv.SearchListPortlet"; url += "&wsrp-mode=view&wsrp-windowstate=normal"; url += "&MODE=MODE_RESULTS_LIST&"; url += extraUrlParams; var feat = "width=700,height=600"; feat += ",menubar=no,resizable=yes,toolbar=no,scrollbars=yes"; var win = window.open(url, "TestSearchPopup", feat); if (win) win.focus(); } var search1a = "ENTITY_DEF=user"; search1a += "&COND_ROW_ATTR=FirstName"; search1a += "&COND_ROW_REL_OP=starts-with"; search1a += "&COND_ROW_VAL=A"; ...
To call this function, you might have a button on the form with onclick event that looks like this:
<input type="button" value="GO" onclick="openSearchResults(search1a)"/>
The following table describes the request parameters:
Table B-1 Request Parameters for Basic Search
If you prefer to format your query as a JSON string, you need to pass the QUERY parameter to the SearchListPortlet, instead of the request parameters described in the section above. The JavaScript variable shown below illustrates how the QUERY parameter is constructed:
var search1b ='QUERY={"k":"Lastname starts with B","mxPg":"10",'; search1b +='"mxRes":"0","ptr":"1","grp":[{"map":{"row":[{"map":{'; search1b +='"rowRop":"starts-with","rowVal":"B","rowAttr":"LastName"'; search1b +='}}],"rowLop":"and"}}],'; search1b +='"orderBy":"LastName","entDef":"user",'; search1b +='"sScope":"","sRoot":"","grpLop":"and",'; search1b +='"selAttr":["FirstName","LastName",'; search1b +='"Title","Email","TelephoneNumber"]}';
The JSON structure gives you a way to specify values for most of the settings and preferences associated with the SearchListPortlet.
The following table describes the JSON name/value pairs that define the QUERY parameter passed to the SearchListPortlet:
Table B-2 JSON Structure for Defining the QUERY Parameter
JSON Setting |
Description |
---|---|
k |
Specifies a name for the search. (Optional) |
mxPg |
Specifies the maximum number of rows per page. (Optional) |
mxRes |
Specifies the maximum number of total rows retrieved. (Optional) |
ptr |
Sets the scroll pointer, which defines the pagination offset. (Optional) |
grp |
Defines a condition group. You can specify one or more condition groups. For details on the settings for a condition group, see Table B-3. |
orderBy |
Specifies the attribute to sort on. (Optional) |
entDef |
Specifies an entity in the Directory Abstraction Layer. |
sScope |
Sets the search scope. (Optional) |
sRoot |
Sets the search root. (Optional) |
grpLop |
Defines the logical operator ( and or or) for groups within this query. |
selAttr |
Lists the attributes to include in the search results. |
The following table describes the JSON structure for defining a condition group:
Table B-3 JSON Structure for Defining a Condition Group
JSON Setting |
Description |
---|---|
row |
Defines a condition row. You can specify one or more condition rows. For details on the settings for a condition row, see Table B-4. |
rowLop |
Defines the logical operator ( and or or) for rows within this group. |
The following table describes the JSON structure for defining a condition row:
Table B-4 JSON Structure for Defining the Fields for a Condition Row
JSON Setting |
Description |
---|---|
rowRop |
Defines the relational operator. The relational operators supported in JSON are the same as those for basic searches using request parameters. For a complete list of the relational operators, see the description of COND_ROW_REL_OP in Table B-1. |
rowVal |
Sets the search value. |
rowAttr |
Specifies the attribute to search on. |