def __search(self, searchField): indexer = self.services.getIndexer() portalQuery = self.services.getPortalManager().get(self.portal.getName()).getQuery() portalSearchQuery = self.services.getPortalManager().get(self.portal.getName()).getSearchQuery() # Security prep work current_user = self.page.authentication.get_username() security_roles = self.page.authentication.get_roles_list() security_filter = 'security_filter:("' + '" OR "'.join(security_roles) + '")' security_exceptions = 'security_exception:"' + current_user + '"' owner_query = 'owner:"' + current_user + '"' security_query = "(" + security_filter + ") OR (" + security_exceptions + ") OR (" + owner_query + ")" startRow = 0 numPerPage = 25 numFound = 0 req = SearchRequest(searchField) if portalQuery: req.addParam("fq", portalQuery) if portalSearchQuery: req.addParam("fq", portalSearchQuery) if not self.page.authentication.is_admin(): req.addParam("fq", security_query) objectIdList = [] while True: req.addParam("fq", 'item_type:"object"') req.addParam("rows", str(numPerPage)) req.addParam("start", str(startRow)) out = ByteArrayOutputStream() indexer.search(req, out) result = JsonSimpleConfig(ByteArrayInputStream(out.toByteArray())) docs = result.getJsonList("response", "docs") docIds = [] for doc in docs: docId = doc.getString(None, "storage_id") if docId is not None: docIds.append(docId) objectIdList.extend(docs) startRow += numPerPage numFound = int(result.getString(None, "response", "numFound")) if (startRow > numFound): break return objectIdList