To perform an ad hoc search and return paged results, use the RMPagedSearch interface. Instantiate an RMPagedSearch object by calling the RMObjectStore.getRMPagedSearch() method.
The following table provides a description of these parameters.
Parameter | Description |
---|---|
asSearchSQLstmt | Contains a valid SQL statement string that defines the criteria
for searching metadata in a FPOS. If only content is to be searched,
this parameter contains properties, such as ID and aggregation, that
identify the objects to be searched. It must contain the ClassDescription
property in the SELECT list. For example, SELECT d.DocumentTitle,
d.ClassDescription, d.Creator FROM Document d WHERE d.[DocumentTitle]
LIKE '%abc%'. The SELECT statement for this parameter needs to be the same as in the asNonPropSQLstmt parameter. |
asNonPropSQLstmt | This is only needed when the asOperator parameter is "OR".
It contains a valid SQL statement string containing non-property related
conditions like specifying the file plan or class. For example, SELECT
d.DocumentTitle, d.ClassDescription, d.Creator FROM Document d WHERE
(d.This insubfolder '/Records Management/File Plan'). If the asOperator parameter is "AND", set this value as null. |
asContentSearchWhereClause | Contains a string that defines the WHERE clause for a content-based
search in the Record Object Store (ROS). For example, contains(content,
'(testCBR)') For a metadata search, this parameter needs to be null. |
asOperator | Contains a string specifying either the moOR_OPERATOR or moAND_OPERATOR
operator to indicate the merge option for the metadata or content
search on the FPOS and the content search on the ROS. This parameter cannot be null if the asContentSearchWhereClause is provided. |
aiObjectType | An int value identifying the type of object to be searched. The object type must be either BaseObject.TYPE_DOCUMENT or BaseObject.TYPE_FOLDER |
pageSize | A positive int value specifying the size of the returned pages. |
filterByParent | A boolean value specifying if the query contains the "filter
by parent" clause and should only be used in the asSearchSQLstmt parameter.
True indicates the query contains the "filter by parent" clause. False
indicates that there is no "filter by parent" clause in the query.
For example, the filterByParent parameter should
be set to false if the following values are passed for the asSearchSQLstmt parameter: SELECT d.Id, d.ClassDescription FROM ([RecordFolder] f inner join ReferentialContainmentRelationship r on f.This=r.Tail) inner Join [RecordInfo] d on d.This=r.Head WHERE ((d.[isDeleted] = false) and ((f.[IsHiddenContainer] = false) and (f.[RecordFolderName] LIKE '%test%'))) and (d.[VersionStatus] = 1) and d.[isDeleted] = false |
ObjectStore loStore = ObjectFactory.getObjectStore (asObjectStoreName, aoSession); // creates an object of RMObjectStore and instantiate RMPagedSearch. RMObjectStore loRMStore = new RMUtil().getRMObjectStore(loStore); RMPagedSearch pagedSearch = loRMStore.getRMPagedSearch(); String stmt = "Select d.DocumentTitle, d.Creator, d.DateCreated, d.ClassDescription from Document d Where d.Creator='jdoe'"; String asContentSearchWhereClause = "(contains(content, '(testCBR)'))"; String asOperator = "AND"; int pageSize = 50; // set to return 50 documents each page call. pagedSearch.singleObjectTypeExecute(asSearchSQLstmt, null, asContentSearchWhereClause, asOperator, BaseObject.DOCUMENT_TYPE, pageSize, false); while (pagedSearch.hasNextPage()) { String objectsetXML = pagedSearch.nextPageXML(); system.out.println(objectsetXML); }
ObjectStore loStore = ObjectFactory.getObjectStore (asObjectStoreName, aoSession); // creates an object of RMObjectStore and instantiate RMPagedSearch. RMObjectStore loRMStore = new RMUtil().getRMObjectStore(loStore); RMPagedSearch pagedSearch = loRMStore.getRMPagedSearch(); String stmt = "Select d.DocumentTitle, d.Creator, d.DateCreated, d.ClassDescription from Document d Where d.[DocumentTitle] LIKE '%doc%'"; String asContentSearchWhereClause = "(contains(content, '(testCBR)'))"; String asOperator = "AND"; int pageSize = 50; // set to return 50 documents each page call. pagedSearch.singleObjectTypeExecute(asSearchSQLstmt, null, asContentSearchWhereClause, asOperator, BaseObject.DOCUMENT_TYPE, pageSize, false); while (pagedSearch.hasNextPage()) { Object[] rowset = pagedSearch.nextPage(); int size= (rowset!= null) ? rowset.length : 0; for (int i = 0; i < size; i++) { RepositoryRow row = (RepositoryRow)rowset[i]; String docTitle = row.getProperties().getStringValue("DocumentTitle"); system.out.println(docTitle); } }
RMPagedSearch pagedSearch = objStore.getRMPagedSearch(); String stmt = "Select d.DocumentTitle, d.ClassDescription from Document d Where d.Creator='jdoe' order by d.DocumentTitle"; String asNonPropSQLstmt = null; String asContentSearchWhereClause = "(contains(content, '(testCBR)'))"; String asOperator = "AND"; int pageSize = 50; // set to return 50 documents each page call. boolean filterByParent=false; pagedSearch.singleObjectTypeExecute(stmt,asNonPropSQLstmt, asContentSearchWhereClause, asOperator, BaseObject.TYPE_DOCUMENT, pageSize, filterByParent) while (pagedSearch.hasNextPage()) { Object[] rowset = pagedSearch.nextPage(); if (rowset == null || rowset.size() == 0) { // The end of paging. No more search results. break; } else { //Process rowset ... ... } }