DOCUMENTS 5 - PortalScripting API
|
The HitResultset class allows comprehensive search operations in Documents and in connected archives. More...
Public Member Functions | |
dispose () | |
Free most of the memory of the HitResultset. More... | |
number | fetchedSize () |
Get the number of already loaded hits in the set. More... | |
boolean | fetchNextPage () |
Load the next page of hits into the Resultset. More... | |
DocHit | first () |
Retrieve the first DocHit in the HitResultset. More... | |
DocHit | getAt (number pos) |
Retrieve the DocHit object at a given position in the HitResultset. More... | |
number | getColumnCount () |
Get the number of available columns in the set of hits. More... | |
number | getColumnIndex (String colName) |
Find the index of a column with a defined name. More... | |
Array | getColumnNames (boolean local=False) |
List the names of all columns in the set of hits. More... | |
string [] | getHitIds (boolean withServer=true) |
Returns an array with all Hit-Ids (file ids or archive file keys) of the HitResultset. More... | |
String | getLastError () |
Function to get the description of the last error (or warning) that occurred. More... | |
number | getLastErrorCode () |
Function to get a numeric code of the last error, that occurred. More... | |
HitResultset | HitResultset (Var searchResources, String filter, String sortOrder, Var hitlist, number pageSize=0, boolean unlimitedHits=false, boolean fullColumnLength=false, boolean withBlobInfo=false) |
Perform a search and create a new HitResultset object. More... | |
DocHit | next () |
Retrieve the next DocHit in the HitResultset. More... | |
number | size () |
Get the total amount of hits in the set. More... | |
The HitResultset class allows comprehensive search operations in Documents and in connected archives.
While the constructor of this class launches a search operation, the created object stores the results and exposes them as a list of DocHit objects. Compared with the classes FileResultset
and ArchiveFileResultset
this class has got the following characteristics.
getLastErrorCode()
and getLastError()
respectively. Advantage: The caller gets the freedom to process the results also after a warning. In this case the hit list maybe incomplete or unsorted.HitResultset HitResultset::HitResultset | ( | Var | searchResources, |
String | filter, | ||
String | sortOrder, | ||
Var | hitlist, | ||
number | pageSize = 0 , |
||
boolean | unlimitedHits = false , |
||
boolean | fullColumnLength = false , |
||
boolean | withBlobInfo = false |
||
) |
Perform a search and create a new HitResultset object.
searchResources | The list of resources to search through. The resource identifiers may be passed either as an array of strings or as an ordinary string with one identifier per line of text. Please read the remarks section about restrictions. |
filter | A filter expression. Pass an empty string, if no filter ist required. |
sortOrder | A sort expression. Pass an empty string, if no sorting is required. |
hitlist | The technical name of a hitlist or an array of field names, which specifies the available columns in the resultset. If the parameter is left empty, Documents tries to choose a hitlist automatically. Details follow in the remarks section. Note: If this parameter is an array of field names, a search in EE.i or EE.x is not allowed and the field names must not contain commas (,). |
pageSize | This is a memory-saving and performance-tuning option. If the parameter is zero, Documents will load all available hits at once. If the parameter is a positive value, Documents will initially load only the requested number of hits as a first page. In order to access each further page, a call to fetchNextPage() is necessary. A negative pageSize value will be replaced by the current user's "hits per page" preference setting. |
unlimitedHits | A boolean that indicates, if the general hit limitations on filetypes and archives must be ignored. A wasteful use of this option may cause issues with the system performance or situations with low free memory. |
fullColumnLength | A boolean that indicates, if the general hit column length limitations must be ignored. The default column length is 50 characters (if not a different value is defined by the property Documents-Settings: MaxHitfieldLength). If a field value exceeds this size, the first 50 characters will be displayed followed by '...'. If the parameter fullColumnLength is set to true , no truncation will be done. |
withBlobInfo | A boolean that indicates, if the HitResultset should contain blob-information that can be fetched with DocHit.getBlobInfo() |
getLastErrorCode()
or getLastError()
.Resource identifiers:
A "resource identifier" can be one of the following: [ examples in brackets ]
Archive resource identifiers should always get a "@Servername" appendix, though Documents recognizes EE.x and EE.i resources of the primary archive server without that appendix.
Resource ordering and hitlist specification
The resource, which owns a specified hitlist, has to be passed in the first position of the list. Search requests in EE.i/EE.x-archives do not work with a filetype's hitlist. These archives require a hitlist of their own. For this reason, a list of resources of different types must be ordered in the following way: EE.x before EE.i before anything else. Requests, which involve more than one Easy Enterprise server can work only, if a hitlist of the given name exists in each resource of these servers.
Automatic hitlist selection
If the parameter "hitlist" is an empty string, Documents scans the search resources for a named hitlist. If no named hitlist exists, Documents initializes an old-fashioned anonymous hitlist, which is based on the "Display in hit list" option of fields in the Documents Manager and on corresponding options for particular DocFile attributes (title, created, owner, last modified, last editor). An anonymous hitlist does actually not work with EE.x. It partially works with EE.i. In this case, Documents externally uses the setting "CommonDefaultHitlist" of the configuration file "ArchiveXML.ini" and transfers matching columns into the internal hitlist. As long as named hitlists become imported with the archive structure, it does not matter.
Search requests, which involve more than one Easy Enterprise server cannot rely on the automatic selection feature. Scripts should always pass an appropriate hitlist name for these requests.
fullColumnLength
hitlist
parameter: an array of field names instead of a hitlist name) HitResultset::dispose | ( | ) |
Free most of the memory of the HitResultset.
This function explicitly frees the memory used by the object. The Resultset itself becomes empty. All extracted DocHit objects become invalid and must no longer be used. Long-running scripts should use this function instead of waiting for the garbage collector to clean up.
number HitResultset::fetchedSize | ( | ) |
Get the number of already loaded hits in the set.
boolean HitResultset::fetchNextPage | ( | ) |
Load the next page of hits into the Resultset.
If the object has been created with a non-zero page size, each call of this function appends another page of hits to the resultset until all hits are loaded.
DocHit HitResultset::first | ( | ) |
Retrieve the first DocHit in the HitResultset.
null
in case of an empty HitResultset DocHit HitResultset::getAt | ( | number | pos | ) |
Retrieve the DocHit object at a given position in the HitResultset.
pos | Integer position of the hit, beginning with 0 |
null
if the position is out of bounds. number HitResultset::getColumnCount | ( | ) |
Get the number of available columns in the set of hits.
number HitResultset::getColumnIndex | ( | String | colName | ) |
Find the index of a column with a defined name.
colName | The name of the column. |
Array HitResultset::getColumnNames | ( | boolean | local = False | ) |
List the names of all columns in the set of hits.
local | A boolean option to read the localized names instead of the technical names. |
Columns, which correspond to a DocFile attribute may be given a special constant name instead of the name in an archive's scheme. "TITLE" on EE.x and "110" on EE.i may be presented as "DlcFile_Title", for example.
string [] HitResultset::getHitIds | ( | boolean | withServer = true | ) |
Returns an array with all Hit-Ids (file ids or archive file keys) of the HitResultset.
withServer | optional boolean value to indicate, if the archive file keys should include an "@archiveServerName" appendix. |
String HitResultset::getLastError | ( | ) |
Function to get the description of the last error (or warning) that occurred.
number HitResultset::getLastErrorCode | ( | ) |
Function to get a numeric code of the last error, that occurred.
DocHit HitResultset::next | ( | ) |
Retrieve the next DocHit in the HitResultset.
null
if either the end of the resultset or the end of the loaded pages is reached. number HitResultset::size | ( | ) |
Get the total amount of hits in the set.