Class ecm.model.SearchTemplate


Extends ecm.model._SearchTemplateBase.
Represents the search criteria that are defined for a search template. For IBM Content Manager OnDemand, the search template is equivalent to a folder.

To improve performance, the search criteria are not filled in the search template initially. Instead, the retrieveSearchCriteria must be called to initiate an asynchronous request to make the search criteria available.

At run time, a user can set the values in the search template to start a search.


Private functions should not be used to access public members of the class. Access member variables directly. For example:

var searchTemplate = new SearchTemplate({ id: "id", name: "search1", description: "my search", objectType: "document" });
console.debug("Search object type=" + searchTemplate.objectType);

Note: Private getter methods, such as getObjectType, will be removed in a future release.
Defined in: <ecm\model\SearchTemplate.js>.

Constructor Summary

Constructor Attributes Constructor Name and Description
 
Constructs a search template.

Field Summary

Field Attributes Field Name and Description
 
An array of ecm.model.SearchClass objects
 
A boolean value indicating whether the search is editable
 
An array ecm.model.SearchFolder objects
 
A boolean value indicating whether the search is configured to include sub classes in query criteria
 
A boolean value indicating whether the search file type is invalid.
 
A boolean value indicating whether the text search criteria is invalid.
 
A boolean value indicating whether the work criteria are invalid.
 
An object holding the extended search options
 
An array of object store objects
 
A string value holding the search object type
 
An array of saved search names (CMOD only)
 
A boolean value indicating whether the search is a private search (CMOD only)
 
A boolean value indicating whether the serach is a public search (CMOD only)
 
A boolean value indicating whether the search is viewable (CMOD only)
 
The number of items to display per page in the search results (FileNet P8, IBM Content Manager, and CMIS only).
 
A string value holding the product name
 
A boolean value indicating whether this search is using teamspace macros
 
A string value holding the text based search criteria value
 
A string value holding the text based search type
Fields borrowed from class ecm.model._SearchTemplateBase:
andSearch, autoResolved, autoRun, description, invalidClass, invalidFolder, invalidProperty, invalidRepository, parentFolderId, searchConfig, searchCriteria, showInTree, UUID

Method Summary

Method Attributes Method Name and Description
 
Returns a clone of this search.
 
containsEqualCriteria(searchTemplate)
Compares the criteria of search templates and return true if they are equal.
 
deleteODQueries(queryies, callback)
Delete a search from OnDemand.
 
Generates a query string from the (likely filled in) search template.
 
Return the ecm.model.ContentClass used in this search
 
Indicates whether this search is configured to run automatically when opened.
 
Returns boolean value if search template was created by Navigator search builder.
 
Indicates whether this search can be displayed in a tree view widget.
 
Indicates whether this search contains text search criteria.
 
Retrieves named queries from OnDemand for this search template.
 
retrieveODSavedQuery(queryName, callback)
Retrieves a named query from OnDemand for this search template.
 
saveODQuery(queryName, isPublic, callback)
Save a search to OnDemand.
 
search(callback, sortProperty, descending, teamspace, errorCallback)
Perform a search using the (filled in) search template.
 
searchDocument(documentId, callback)
Perform a search for the contained items object specified object
 
Set the search criteria to be a OD saved query (CMOD only)
 
setSearchContentClass(searchContentClass)
Set the content class for the search
 
toJson(searching)
Convert the search criteria into Json format
 
toRecentSearchJson(contextId, userId)
 
updateAllowedValues(name, names, values, callback)
Update the allowed criteria values on the serach template
Methods borrowed from class ecm.model._SearchTemplateBase:
equals, generateUUID, isAttributeHidden, isLoaded, isNew, onSearchCriteriaRetrieved, onUnsupportedSearchCriteriaRetrieved, retrieveSearchCriteria, save

Constructor Detail

ecm.model.SearchTemplate(properties)

Constructs a search template.
Parameters:
properties
The properties of the search template. The properties can be any of the public fields as defined below, plus those of the ecm.model.ContentItem, ecm.model.Item, and ecm.model._ModelObject.

Field Detail

classes

An array of ecm.model.SearchClass objects

editable

A boolean value indicating whether the search is editable

folders

An array ecm.model.SearchFolder objects

includeSubclasses

A boolean value indicating whether the search is configured to include sub classes in query criteria

invalidFileType

A boolean value indicating whether the search file type is invalid.

invalidTextSearch

A boolean value indicating whether the text search criteria is invalid.

invalidWork

A boolean value indicating whether the work criteria are invalid.

moreOptions

An object holding the extended search options

objectStores

An array of object store objects

objectType

A string value holding the search object type

odSavedSearches

An array of saved search names (CMOD only)

odViewPrivateSearch

A boolean value indicating whether the search is a private search (CMOD only)

odViewPublicSearch

A boolean value indicating whether the serach is a public search (CMOD only)

odViewSavedSearch

A boolean value indicating whether the search is viewable (CMOD only)

pageSize

The number of items to display per page in the search results (FileNet P8, IBM Content Manager, and CMIS only). If the specified value is less than 0, then 200 items per page are displayed by default. If the specified value is 0, then the maximum number of items retrieved is limited only by the query or the repository, and all items found are displayed on one page.

Important: If you display the search results in a content list, small page sizes (typically less than 50) are not recommended because additional requests might be sent to fill the content list. For example, if the content list displays 10 rows, and you set the page size to 6, the first 6 items returned by the search are displayed, but to fill the content list, an additional query attempts to retrieve 4 more items.
Since:
2.0.3.3

productName

A string value holding the product name

teamspaceMacroSearch

A boolean value indicating whether this search is using teamspace macros

textSearchCriteria

A string value holding the text based search criteria value

textSearchType

A string value holding the text based search type

Method Detail

clone()

Returns a clone of this search.

containsEqualCriteria(searchTemplate)

Compares the criteria of search templates and return true if they are equal.
Parameters:
searchTemplate
A ecm.model.SearchTemplate to use for comparison

deleteODQueries(queryies, callback)

Delete a search from OnDemand.
Parameters:
queryies
Name of the queries to delete.
callback
A callback function called after the search has been deleted.

getQueryString()

Generates a query string from the (likely filled in) search template. The query string has a JSON syntax, and is a JSON string of an array of objects with name, operator, and values fields, as in this example:
'[{"name":"TIMESTAMP","operator":"Equals","values":["",""]},{"name":"USER_ID","operator":"Equals","values":["anderson",""]},{"name":"SOURCE","operator":"Equals","values":["scanner",""]}]'

getSearchContentClass()

Return the ecm.model.ContentClass used in this search

isAutoRun()

Indicates whether this search is configured to run automatically when opened.

isNavigatorSavedSearch()

Returns boolean value if search template was created by Navigator search builder.

isShowInTree()

Indicates whether this search can be displayed in a tree view widget.

isTextSearchCriteriaPresent()

Indicates whether this search contains text search criteria.

retrieveODSavedQueries(callback)

Retrieves named queries from OnDemand for this search template.
Parameters:
callback
Callback method to allow the caller to take action after retrieve of named queries completes.

retrieveODSavedQuery(queryName, callback)

Retrieves a named query from OnDemand for this search template.
Parameters:
queryName
Name of the query to retrieve.
callback
Callback method to allow the caller to take action after the named query is complete.

saveODQuery(queryName, isPublic, callback)

Save a search to OnDemand.
Parameters:
queryName
Name of the query to save.
isPublic
A boolean value indicating whether this search is public
callback
A callback function called after the named query has completed being saved.

search(callback, sortProperty, descending, teamspace, errorCallback)

Perform a search using the (filled in) search template.
Parameters:
callback
A callback function to be called after the search has been performed. Passes a ecm.model.ResultSet as a parameter.
sortProperty
A string value holding the property name to used as the sort property
descending
A flag indicating the sort direction (ie. ascending or descending)
teamspace
A ecm.model.Teamspace object (if the search is run within the context of a teamspace
errorCallback
A callback function to call if there are errors returned when performing the search

searchDocument(documentId, callback)

Perform a search for the contained items object specified object
Parameters:
documentId
A string value holding a document id
callback
A callback function to be called after the search has been performed. Passes a ecm.model.ResultSet as a parameter.

setCritieraToODSavedQuery(odSavedQuery)

Set the search criteria to be a OD saved query (CMOD only)
Parameters:
odSavedQuery
A ecm.model.ODSavedSearch object

setSearchContentClass(searchContentClass)

Set the content class for the search
Parameters:
searchContentClass
A ecm.model.ContentClass object or ecm.model.SearchContentClasses if multiple classes specified

toJson(searching)

Convert the search criteria into Json format
Parameters:
searching

toRecentSearchJson(contextId, userId)

Parameters:
contextId
userId
Deprecated:
As of release 2.0.2

updateAllowedValues(name, names, values, callback)

Update the allowed criteria values on the serach template
Parameters:
name
A string value holding the criteria name
names
An array of criteria names
values
An array of criteria values
callback
A callback function to be called after the critera values have been updated