This is a framework to analyze query strings before sending them to a search engine. It comes as a library that can be used in your own project. It also contains a Flask app with two endpoints (suggest and search) and a web interface to interact with it in an experimental way.
Install the requirements listed in the requirements.txt
file or pip install with pip install -e .
before running the application. You do need a working Rust toolchain for the Granne library.
The service reads the following environment variables:
ENVIRONMENT
(defaults toenvironment_unset
): if set todev
it enables thePOST
ing a new configuration to the/config
endpointCONFIGFILE
(defaults todefault.yml
): the location of the configuration fileLOGGING
(defaults towarn
): the logging level
The service can be configured by composing a custom pipeline of filters. The
configuration can be loaded from a config file (set with the CONFIGFILE
environment variable). In a dev
environment the configuration can be changed
through by POST
ing a configuration to the /config
endpoint.
The service exposes a Swagger page under /docs
.
To start the app run uvicorn app:app --port 5000
from within the repo. The web
interface will be served on http://127.0.0.1:5000/. Only a minimal set of data
is coming with the repo. To use full functionality (like similar queries) you need
to get data from an S3 bucket or the file system. The data can be kept
outside of the repo, the path can be set in the configuration.
The endpoint can be reached under /suggest
, it takes two query parameters:
query
: the user queryproduct
: mendeley or scopus, only important for query rewriting
The response of the endpoint depends on the active filters and can be configured to have the most convenient shape through additional filters.