Coder Social home page Coder Social logo

faq-searcher's Introduction

faq-searcher

Python 3 Flask application to search the libanswers FAQ searcher.

Requires

  • Python 3.10.8

Development Setup

See docs/DevelopmentSetup.md.

Environment Configuration

The application requires a ".env" file in the root directory to provide server-specific information (i.e., those parts of the configuration that may vary based on whether the server is a test/qa/production server).

A sample "env_example" file has been provided to assist with this process. Simply copy the "env_example" file to ".env" and fill out the parameters as appropriate.

The configured .env file should not be checked into the Git repository.

Running in Docker

$ docker build -t docker.lib.umd.edu/faq-searcher .
$ docker run -it --rm -p 5000:5000 --env-file=.env --read-only docker.lib.umd.edu/faq-searcher

Building for Kubernetes

$ docker buildx build . --builder=kube -t docker.lib.umd.edu/faq-searcher:VERSION --push

Endpoints

This will start the webapp listening on the default port 5000 on localhost (127.0.0.1), and running in Flask's debug mode.

Root endpoint (just returns {status: ok} to all requests): http://localhost:5000/

/ping endpoint (just returns {status: ok} to all requests): http://localhost:5000/ping

/search:

http://localhost:5000/search?q=print&per_page=3&page=0

Example:

curl 'http://localhost:5000/search?q=print&per_page=3&page=0'
{
  "endpoint": "faq",
  "module_link": "http://umd.libanswers.com/search?q=print",
  "page": 0,
  "per_page": 3,
  "query": "print",
  "results": [
    {
      "description": "Photocopying, Printing, Library 101",
      "item_format": "web_page",
      "link": "https://umd.libanswers.com/faq/66289",
      "title": "How do I print?"
    },
    {
      "description": "Printing, Makerspace",
      "item_format": "web_page",
      "link": "https://umd.libanswers.com/faq/66460",
      "title": "Can I 3D Print in two different colors?"
    },
    {
      "description": "Photocopying, Printing, Library 101",
      "item_format": "web_page",
      "link": "https://umd.libanswers.com/faq/66032",
      "title": "How can I print and/or make copies?"
    }
  ],
  "total": 42
}

License

See the LICENSE file for license rights and limitations.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.