On 02/17/2014 08:10 AM, ignatenkobrain(a)fedoraproject.org wrote:
> +
> +(a)api_ns.route("/coprs/search/")
> +(a)api_ns.route("/coprs/search/<project>/")
> +def api_coprs_search_by_project(project=None):
> + """ Return the list of coprs found in search by the given project.
> + project is taken either from GET params or from the URL itself
> + (in this order).
> +
> + :arg project: the project one would like find for coprs.
> +
> + """
> + project = flask.request.args.get("project", None) or project
> + httpcode = 200
> + if project:
> + query = coprs_logic.CoprsLogic.get_multiple(
> + flask.g.user, coprname=project)
> +
> + repos = query.all()
> + output = {"output": "ok", "users": []}
> + for repo in repos:
> + output["users"].append({"name": repo.owner})
> + else:
> + output = {"output": "notok", "error": "Invalid request"}
> + httpcode = 500
> +
> + jsonout = flask.jsonify(output)
> + jsonout.status_code = httpcode
> + return jsonout
Hmm, I would expect that this api call would do fulltext search using whooshe.
Same as /coprs/fulltext/ in WebUI.
--
Miroslav Suchy, RHCE, RHCDS
Red Hat, Senior Software Engineer, #brno, #devexp, #fedora-buildsys