code: def search(cls, session, opts, operator):
          
          available = {'name': Package.name,
                       'version': cls.version,
                       'author': User.login,
                       'author_email': User.email,
                       'maintainer': User.login,
                       'maintainer_email': User.email,
                       'home_page': cls.home_page,
                       'license': cls.license,
                       'summary': cls.summary,
                       'description': cls.description,
                       'keywords': cls.keywords,
                       'platform': cls.platform,
                       'download_url': cls.download_url
                       }
          oper = {'or': or_, 'and': and_}
          join_map = {'name': Package,
                      'author': cls.author,
                      'author_email': cls.author,
                      'maintainer': cls.maintainer,
                      'maintainer_email': cls.maintainer,
                      }
          where = []
          join = []
          for opt, val in opts.items():
              field = available[opt]
              if hasattr(val, '__iter__') and len(val) > 1:
                  stmt = or_(*[field.like(u'%%%s%%' % v) for v in val])
              else:
                  stmt = field.like(u'%%%s%%' % val)
              where.append(stmt)
              if opt in join_map:
                  join.append(join_map[opt])
          return cls.find(session, join=join,
                          where=(oper[operator](*where),))
docs: Get releases for given filters.
  
          :param session: SQLAlchemy session
          :type session: :class:`sqlalchemy.Session`
  
          :param opts: filtering options
          :type opts: dict
  
          :param operator: filtering options joining operator (`and` or `or`)
          :type operator: basestring
  
          :return: release instances
          :rtype: generator of :class:`pyshop.models.Release`