Zimlet JavaScript API Reference - ZmSearch

Class ZmSearch


This class represents a search to be performed on the server. It has properties for the different search parameters that may be used. It can be used for a regular search, or to search within a conversation. The results are returned via a callback.

Defined in: ZmSearch.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
ZmSearch(params)
Creates a new search with the given properties.
Method Summary
Method Attributes Method Name and Description
 
Clears cursor-related fields from this search so that it will not create a cursor.
 
getConv(params)
Fetches a conversation from the server.
 
Gets a title that summarizes this search.
 
Returns true if the query has a "content" term.
 
Returns true if the query has a folder-related term with the given value.
 
hasTagTerm(tagName)
Returns true if the query has a tag term with the given value.
 
Returns true if the query has a term related to unread status.
 
Returns true if the query has the term "is:anywhere".
 
Checks if this search is multi-account.
 
Returns true if the query has just one term, and it's a folder or tag term.
 
matches(item)
Tests the given item against a matching function generated from the query.
 
replaceFolderTerm(oldPath, newPath)
Replaces the old folder path with the new folder path in the query string, if found.
 
replaceTagTerm(oldName, newName)
Replaces the old tag name with the new tag name in the query string, if found.
Class Detail
ZmSearch(params)
Creates a new search with the given properties.
Parameters:
{Hash} params
a hash of parameters
{String} params.query
the query string
{String} params.queryHint
the query string that gets appended to the query but not something the user needs to know about
{AjxVector} params.types
the item types to search for
{Boolean} params.forceTypes
use the types we pass, do not override (in case of mail) to the current user's view pref (MSG vs. CONV).
{constant} params.sortBy
the sort order
{int} params.offset
the starting point within result set
{int} params.limit
the number of results to return
{Boolean} params.getHtml
if true, return HTML part for inlined msg
{constant} params.contactSource
where to search for contacts (GAL or personal)
{Boolean} params.isGalAutocompleteSearch
if true, autocomplete against GAL
{constant} params.galType
the type of GAL autocomplete (account or resource)
{constant} params.autocompleteType
the type of autocomplete (account or resource or all)
{int} params.lastId
the ID of last item displayed (for pagination)
{String} params.lastSortVal
the value of sort field for above item
{Boolean} params.fetch
if true, fetch first hit message
{int} params.searchId
the ID of owning search folder (if any)
{Array} params.conds
the list of search conditions ()
{Array} params.attrs
the list of attributes to return ()
{String} params.field
the field to search within (instead of default)
{Object} params.soapInfo
the object with method, namespace, response, and additional attribute fields for creating soap doc
{Object} params.response
the canned JSON response (no request will be made)
{Array} params.folders
the list of folders for autocomplete
{Array} params.allowableTaskStatus
the list of task status types to return (assuming one of the values for "types" is "task")
{String} params.accountName
the account name to run this search against
{Boolean} params.idsOnly
if true, response returns item IDs only
{Boolean} params.inDumpster
if true, search in the dumpster
{string} params.origin
indicates what initiated the search
{boolean} params.isEmpty
if true, return empty response without sending a request
Method Detail
clearCursor()
Clears cursor-related fields from this search so that it will not create a cursor.

getConv(params)
Fetches a conversation from the server.
Parameters:
{Hash} params
a hash of parameters:
{String} params.cid
the conv ID
{AjxCallback} params.callback
the callback to run with result
{String} params.fetch
which msg bodies to load (see soap.txt)
{Boolean} params.markRead
if true, mark msg read
{Boolean} params.noTruncate
if true, do not limit size of msg
{boolean} params.needExp
if not false, have server check if addresses are DLs

{String} getTitle()
Gets a title that summarizes this search.
Returns:
{String} the title

hasContentTerm()
Returns true if the query has a "content" term.

hasFolderTerm(path)
Returns true if the query has a folder-related term with the given value.
Parameters:
{string} path
a folder path (optional)

hasTagTerm(tagName)
Returns true if the query has a tag term with the given value.
Parameters:
{string} tagName
a tag name (optional)

hasUnreadTerm()
Returns true if the query has a term related to unread status.

isAnywhere()
Returns true if the query has the term "is:anywhere".

{Boolean} isMultiAccount()
Checks if this search is multi-account.
Returns:
{Boolean} true if multi-account

isSimple()
Returns true if the query has just one term, and it's a folder or tag term.

matches(item)
Tests the given item against a matching function generated from the query.
Parameters:
{ZmItem} item
an item
Returns:
true if the item matches, false if it doesn't, and null if a matching function could not be generated

{boolean} replaceFolderTerm(oldPath, newPath)
Replaces the old folder path with the new folder path in the query string, if found.
Parameters:
{string} oldPath
the old folder path
{string} newPath
the new folder path
Returns:
{boolean} true if replacement was performed

{boolean} replaceTagTerm(oldName, newName)
Replaces the old tag name with the new tag name in the query string, if found.
Parameters:
{string} oldName
the old tag name
{string} newName
the new tag name
Returns:
{boolean} true if replacement was performed

Documentation generated by JsDoc Toolkit 2.3.0 on Tue Jun 28 2016 21:01:39 GMT-0400 (EDT)