1:- module(bc_api_search, []).

Search API handlers */

    5:- use_module(library(arouter)).    6:- use_module(library(http/http_wrapper)).    7:- use_module(library(http/http_parameters)).    8
    9:- use_module(bc_api_io).   10:- use_module(bc_search).   11
   12:- route_get(api/search/Type, search(Type)).   13
   14search(Type):-
   15    http_current_request(Request),
   16    http_parameters(Request, [
   17        q(Query, [atom, default('')]),
   18        l(Language, [atom, default(en)])]),
   19    bc_search(Type, Language, Query, Results),
   20    bc_reply_success(Results)