

@access.public
@filtermodel(model='item')
@describeRoute(Description('Search for an item by certain properties.').responseClass('Item').param('folderId', 'Pass this to list all items in a folder.', required=False).param('text', 'Pass this to perform a full text search for items.', required=False).param('name', 'Pass to lookup an item by exact name match. Must pass folderId as well when using this.', required=False).pagingParams(defaultSort='lowerName').errorResponse().errorResponse('Read access was denied on the parent folder.', 403))
def find(self, params):
    '\n        Get a list of items with given search parameters. Currently accepted\n        search modes are:\n\n        1. Searching by folderId, with optional additional filtering by the name\n           field (exact match) or using full text search within a single parent\n           folder. Pass a "name" parameter or "text" parameter to invoke these\n           additional filters.\n        2. Searching with full text search across all items in the system.\n           Simply pass a "text" parameter for this mode.\n        '
    (limit, offset, sort) = self.getPagingParameters(params, 'lowerName')
    user = self.getCurrentUser()
    if ('folderId' in params):
        folder = self.model('folder').load(id=params['folderId'], user=user, level=AccessType.READ, exc=True)
        filters = {
            
        }
        if params.get('text'):
            filters['$text'] = {
                '$search': params['text'],
            }
        if params.get('name'):
            filters['name'] = params['name']
        return list(self.model('folder').childItems(folder=folder, limit=limit, offset=offset, sort=sort, filters=filters))
    elif ('text' in params):
        return list(self.model('item').textSearch(params['text'], user=user, limit=limit, offset=offset, sort=sort))
    else:
        raise RestException('Invalid search mode.')

dataset/ETHPy150Open girder/girder/girder/api/v1/item.py Item.find/original