def METHOD_NAME(self, args):
    c = self.ctx.conn(args)
    import omero
    import omero.all
    if args.index:
        if not self.ctx.get_event_context().isAdmin:
            self.ctx.die(432, "Only admin can index object")
        try:
            parts = args.type.split(":")
            kls = parts[0].strip()
            kls = getattr(omero.model, kls)
            kls = kls.ice_staticId()
            of = c.getCommunicator().findObjectFactory(kls)
            obj = of.create(kls)
            id = int(parts[1].strip())
            obj.setId(omero.rtypes.rlong(id))
        except Exception as e:
            self.ctx.dbg(e)
            self.ctx.die(432, "Bad object: %s" % args.type)
        c.sf.getUpdateService().indexObject(obj)
    else:
        group = None
        if args.admin:
            group = "-1"
        ctx = c.getContext(group)
        METHOD_NAME = c.sf.createSearchService()
        try:
            try:
                # Matching OMEROGateway.search()
                METHOD_NAME.setAllowLeadingWildcard(True)
                METHOD_NAME.setCaseSensitive(False)
                METHOD_NAME.onlyType(args.type)
                if args.no_parse:
                    if args._from or args._to or args.field:
                        self.ctx.err("Ignoring from/to/fields")
                    METHOD_NAME.byFullText(args.query)
                else:
                    try:
                        if args.date_type == "import":
                            args.date_type = "details.creationEvent.time"
                        METHOD_NAME.byLuceneQueryBuilder(
                            ",".join(args.field),
                            args._from, args._to, args.date_type,
                            args.query, ctx)
                    except OperationNotExistException:
                        self.ctx.err(
                            "Server does not support byLuceneQueryBuilder")
                        METHOD_NAME.byFullText(args.query)
                if not METHOD_NAME.hasNext(ctx):
                    self.ctx.die(433, "No results found.")
                self.ctx.set("search.results", [])
                while METHOD_NAME.hasNext(ctx):
                    results = METHOD_NAME.results(ctx)
                    self.ctx.get("search.results").extend(results)
                    results = [[x] for x in results]
                    if not args.ids_only:
                        results = [[robject(x[0])] for x in results]
                    self.display(results,
                                 style=args.style,
                                 idsonly=args.ids_only)
            except omero.ApiUsageException as aue:
                self.ctx.die(434, aue.message)
        finally:
            METHOD_NAME.close()