Script: Class dw.content.ContentSearchModel

Class ContentSearchModel

The class is the central interface to a content search result and a content search refinement. It also provides utility methods to generate a search URL.

Constants

CONTENTID_PARAMETER : String = "cid"

URL Parameter for the content ID

FOLDERID_PARAMETER : String = "fdid"

URL Parameter for the folder ID

Properties

content : Iterator Read Only

An Iterator containing all Content Assets that are the result of the search.

contentID : String

The content ID against which the search results apply.

deepestCommonFolder : Folder Read Only

The deepest common folder of all content assets in the search result.

filteredByFolder : boolean

The method returns true, if the content search result is filtered by the folder and it is not subsequently possible to search for content assets that belong to no folder (e.g. those for Page Designer).

folder : Folder Read Only

The folder against which the search results apply.

folderID : String

The folder ID against which the search results apply.

folderSearch : boolean Read Only

The method returns true, if this is a pure search for a folder. The method checks, that a folder ID is specified and no search phrase is specified.

pageMetaTags : Array Read Only

All page meta tags, defined for this instance for which content can be generated.

The meta tag content is generated based on the content listing page meta tag context and rules. The rules are obtained from the current folder context or inherited from the parent folder, up to the root folder.

recursiveFolderSearch : boolean

Get the flag that determines if the folder search will be recursive.

refinedByFolder : boolean Read Only

The method returns true, if the search is refined by a folder. The method checks, that a folder ID is specified.

refinedFolderSearch : boolean Read Only

Identifies if this is a folder search and is refined with further criteria, like a name refinement or an attribute refinement.

refinements : ContentSearchRefinements Read Only

The set of search refinements used in this search.

Constructor Summary

ContentSearchModel()

Constructs a new ContentSearchModel.

Method Summary

getContent() : Iterator

Returns an Iterator containing all Content Assets that are the result of the search.

getContentID() : String

Returns the content ID against which the search results apply.

getDeepestCommonFolder() : Folder

Returns the deepest common folder of all content assets in the search result.

getFolder() : Folder

Returns the folder against which the search results apply.

getFolderID() : String

Returns the folder ID against which the search results apply.

getPageMetaTag(id : String) : PageMetaTag

Returns the page meta tag for the specified id.

getPageMetaTags() : Array

Returns all page meta tags, defined for this instance for which content can be generated.

getRefinements() : ContentSearchRefinements

Returns the set of search refinements used in this search.

isFilteredByFolder() : boolean

The method returns true, if the content search result is filtered by the folder and it is not subsequently possible to search for content assets that belong to no folder (e.g.

isFolderSearch() : boolean

The method returns true, if this is a pure search for a folder.

isRecursiveFolderSearch() : boolean

Get the flag that determines if the folder search will be recursive.

isRefinedByFolder() : boolean

The method returns true, if the search is refined by a folder.

isRefinedFolderSearch() : boolean

Identifies if this is a folder search and is refined with further criteria, like a name refinement or an attribute refinement.

search() : SearchStatus

Execute the search.

setContentID(contentID : String) : void

Sets the contentID used in this search.

setFilteredByFolder(filteredByFolder : boolean) : void

Set a flag to indicate if the search is filtered by the folder.

setFolderID(folderID : String) : void

Sets the folderID used in this search.

setRecursiveFolderSearch(recurse : boolean) : void

Set a flag to indicate if the search in folder should be recursive.

static urlForContent(action : String, cid : String) : URL

Returns an URL that you can use to execute a query for a specific Content.

static urlForContent(url : URL, cid : String) : URL

Returns an URL that you can use to execute a query for a specific Content.

static urlForFolder(action : String, fid : String) : URL

Returns an URL that you can use to execute a query for a specific Folder.

static urlForFolder(url : URL, fid : String) : URL

Returns an URL that you can use to execute a query for a specific Folder.

static urlForRefine(action : String, name : String, value : String) : URL

Returns an URL that you can use to execute a query for a specific attribute name-value pair.

static urlForRefine(url : URL, name : String, value : String) : URL

Returns an URL that you can use to execute a query for a specific attribute name-value pair.

urlRefineFolder(action : String, refineFolderID : String) : URL

Returns an URL that you can use to re-execute the query using the specified pipeline action and folder refinement.

urlRefineFolder(url : URL, refineFolderID : String) : URL

Returns an URL that you can use to re-execute the query using the specified URL and folder refinement.

urlRelaxFolder(action : String) : URL

Returns an URL that you can use to re-execute the query with no folder refinement.

urlRelaxFolder(url : URL) : URL

Returns an URL that you can use to re-execute the query with no folder refinement.

Methods inherited from class SearchModel

addRefinementValues, canRelax, getCount, getRefinementMaxValue, getRefinementMinValue, getRefinementValue, getRefinementValues, getSearchPhrase, getSearchRedirect, getSortingCondition, isEmptyQuery, isRefinedByAttribute, isRefinedByAttribute, isRefinedByAttributeValue, isRefinedSearch, isRefinementByValueRange, isRefinementByValueRange, removeRefinementValues, search, setRefinementValueRange, setRefinementValues, setSearchPhrase, setSortingCondition, url, url, urlDefaultSort, urlDefaultSort, urlRefineAttribute, urlRefineAttribute, urlRefineAttributeValue, urlRefineAttributeValue, urlRefineAttributeValueRange, urlRelaxAttribute, urlRelaxAttribute, urlRelaxAttributeValue, urlRelaxAttributeValue, urlSort, urlSort

Methods inherited from class Object

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

Constructor Detail

ContentSearchModel

publicContentSearchModel()

Constructs a new ContentSearchModel.


Method Detail

getContent

getContent() : Iterator

Returns an Iterator containing all Content Assets that are the result of the search.

Returns:

an Iterator containing all Content Assets that are the result of the search.

getContentID

getContentID() : String

Returns the content ID against which the search results apply.

Returns:

the content ID against which the search results apply.


getDeepestCommonFolder

getDeepestCommonFolder() : Folder

Returns the deepest common folder of all content assets in the search result.

Returns:

the deepest common folder of all content assets in the search result of this search model.


getFolder

getFolder() : Folder

Returns the folder against which the search results apply.

Returns:

the folder against which the search results apply.


getFolderID

getFolderID() : String

Returns the folder ID against which the search results apply.

Returns:

the folder ID against which the search results apply.


getPageMetaTag

getPageMetaTag(id : String) : PageMetaTag

Returns the page meta tag for the specified id.

The meta tag content is generated based on the content listing page meta tag context and rule. The rule is obtained from the current folder context or inherited from the parent folder, up to the root folder.

Null will be returned if the meta tag is undefined on the current instance, or if no rule can be found for the current context, or if the rule resolves to an empty string.

Parameters:

id - the ID to get the page meta tag for

Returns:

page meta tag containing content generated based on rules


getPageMetaTags

getPageMetaTags() : Array

Returns all page meta tags, defined for this instance for which content can be generated.

The meta tag content is generated based on the content listing page meta tag context and rules. The rules are obtained from the current folder context or inherited from the parent folder, up to the root folder.

Returns:

page meta tags defined for this instance, containing content generated based on rules


getRefinements

getRefinements() : ContentSearchRefinements

Returns the set of search refinements used in this search.

Returns:

the set of search refinements used in this search.


isFilteredByFolder

isFilteredByFolder() : boolean

The method returns true, if the content search result is filtered by the folder and it is not subsequently possible to search for content assets that belong to no folder (e.g. those for Page Designer).

Returns:

True if this is filtered by the folder of the content asset.


isFolderSearch() : boolean

The method returns true, if this is a pure search for a folder. The method checks, that a folder ID is specified and no search phrase is specified.

Returns:

True if this is a folder search.


isRecursiveFolderSearch() : boolean

Get the flag that determines if the folder search will be recursive.

Returns:

true if the folder search will be recursive, false otherwise


isRefinedByFolder

isRefinedByFolder() : boolean

The method returns true, if the search is refined by a folder. The method checks, that a folder ID is specified.

Returns:

true, if the search is refined by a folder, false otherwise.


isRefinedFolderSearch() : boolean

Identifies if this is a folder search and is refined with further criteria, like a name refinement or an attribute refinement.

Returns:

true if this is a folder search and is refined with further criteria, false otherwise.


search() : SearchStatus

Execute the search.

Returns:

the searchStatus object with search status code and description of search result.


setContentID

setContentID(contentID : String) : void

Sets the contentID used in this search.

Parameters:

contentID - the contentID used in this search.


setFilteredByFolder

setFilteredByFolder(filteredByFolder : boolean) : void

Set a flag to indicate if the search is filtered by the folder. Must be set to false to return content assets that do not belong to any folder.

Parameters:

filteredByFolder - filter the search result by folder


setFolderID

setFolderID(folderID : String) : void

Sets the folderID used in this search.

Parameters:

folderID - the folderID used in this search.


setRecursiveFolderSearch(recurse : boolean) : void

Set a flag to indicate if the search in folder should be recursive.

Parameters:

recurse - recurse the folder in the search


urlForContent

static urlForContent(action : String, cid : String) : URL

Returns an URL that you can use to execute a query for a specific Content. The passed action is used to build an initial url. All search specific attributes are appended.

Parameters:

action - the pipeline action to use.

cid - the content id.

Returns:

an URL that you can use to execute a query for a specific Content. The passed action is used to build an initial url. All search specific attributes are appended.


urlForContent

static urlForContent(url : URL, cid : String) : URL

Returns an URL that you can use to execute a query for a specific Content. The passed url can be either a full url or just the name for a pipeline. In the later case a relative URL is created.

Parameters:

url - the URL to use when constructing the new URL.

cid - the content id.

Returns:

an URL that you can use to execute a query for a specific Content. The passed url can be either a full url or just the name for a pipeline. In the later case a relative URL is created.


urlForFolder

static urlForFolder(action : String, fid : String) : URL

Returns an URL that you can use to execute a query for a specific Folder.

Parameters:

action - the pipeline action to use.

fid - the id of the Folder to use.

Returns:

an URL that you can use to execute a query for a specific Folder.


urlForFolder

static urlForFolder(url : URL, fid : String) : URL

Returns an URL that you can use to execute a query for a specific Folder.

Parameters:

url - the URL to use in constructing the new URL.

fid - the id of the Folder to use.

Returns:

an URL that you can use to execute a query for a specific Folder.


urlForRefine

static urlForRefine(action : String, name : String, value : String) : URL

Returns an URL that you can use to execute a query for a specific attribute name-value pair.

Parameters:

action - the pipeline action to use.

name - the name of the attribute.

value - the value for the attribute.

Returns:

an URL that you can use to execute a query for a specific attribute name-value pair.


urlForRefine

static urlForRefine(url : URL, name : String, value : String) : URL

Returns an URL that you can use to execute a query for a specific attribute name-value pair.

Parameters:

url - the URL to use when constructing the new URL.

name - the name of the attribute.

value - the value for the attribute.

Returns:

an URL that you can use to execute a query for a specific attribute name-value pair.


urlRefineFolder

urlRefineFolder(action : String, refineFolderID : String) : URL

Returns an URL that you can use to re-execute the query using the specified pipeline action and folder refinement.

Parameters:

action - the action to use.

refineFolderID - the folder ID to use as a refinement.

Returns:

an URL that you can use to re-execute the exact same query using the specified pipeline action and folder refinement.


urlRefineFolder

urlRefineFolder(url : URL, refineFolderID : String) : URL

Returns an URL that you can use to re-execute the query using the specified URL and folder refinement.

Parameters:

url - the existing URL to use when constructing the new URL.

refineFolderID - the ID of the folder refinement to use.

Returns:

an URL that you can use to re-execute the query using the specified URL and folder refinement.


urlRelaxFolder

urlRelaxFolder(action : String) : URL

Returns an URL that you can use to re-execute the query with no folder refinement.

Parameters:

action - the pipeline action to use in the URL.

Returns:

an URL that you can use to re-execute the query with no folder refinement.


urlRelaxFolder

urlRelaxFolder(url : URL) : URL

Returns an URL that you can use to re-execute the query with no folder refinement.

Parameters:

url - the existing URL to use when constructing the new URL.

Returns:

an URL that you can use to re-execute the query with no folder refinement.