@app.get('/dossier/v1/feature-collection/<cid>/search/<engine_name>')
@app.post('/dossier/v1/feature-collection/<cid>/search/<engine_name>')
def v1_search(request, response, visid_to_dbid, config,
              search_engines, filters, cid, engine_name):
    '''Search feature collections.

    The route for this endpoint is:
    ``/dossier/v1/<content_id>/search/<search_engine_name>``.

    ``content_id`` can be any *profile* content identifier. (This
    restriction may be lifted at some point.) Namely, it must start
    with ``p|``.

    ``engine_name`` corresponds to the search strategy to
    use. The list of available search engines can be retrieved with the
    :func:`v1_search_engines` endpoint.

    This endpoint returns a JSON payload which is an object with a
    single key, ``results``. ``results`` is a list of objects, where
    the objects each have ``content_id`` and ``fc`` attributes.
    ``content_id`` is the unique identifier for the result returned,
    and ``fc`` is a JSON serialization of a feature collection.

    There are also two query parameters:

    * **limit** limits the number of results to the number given.
    * **filter** sets the filtering function. The default
      filter function, ``already_labeled``, will filter out any
      feature collections that have already been labeled with the
      query ``content_id``.
    '''
    db_cid = visid_to_dbid(cid)
    try:
        search_engine = search_engines[engine_name]
    except __HOLE__ as e:
        bottle.abort(404, 'Search engine "%s" does not exist.' % e.message)
    query = request.query if request.method == 'GET' else request.forms
    search_engine = (config.create(search_engine)
                           .set_query_id(db_cid)
                           .set_query_params(query))
    for name, filter in filters.items():
        search_engine.add_filter(name, config.create(filter))
    return search_engine.respond(response)
dataset/ETHPy150Open dossier/dossier.web/dossier/web/routes.py/v1_search