bluesearch.server.search_server module

The search server.

class SearchServer(trained_models_path, embeddings_h5_path, indices, connection, models)[source]

Bases: flask.app.Flask

The BBS search server.

Parameters
  • trained_models_path (str or pathlib.Path) – The folder containing pre-trained models.

  • embeddings_h5_path (str or pathlib.Path) – The path to the h5 file containing pre-computed embeddings.

  • connection (sqlalchemy.engine.Engine) – The database connection.

  • indices (np.ndarray) – 1D array containing sentence_ids to be considered for precomputed embeddings.

  • models (list_like) – A list of model names of the embedding models to load.

help()[source]

Help the user by sending information about the server.

query()[source]

Respond to a query.

The main query callback routed to “/”.

Returns

response_json – The JSON response to the query.

Return type

flask.Response