Skip to content

GitauHarrison/search-functionality-in-flask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Add A Search Feature To Your Flask App

search

Add Post Search Results
Add post Search results

Demo app displaying how to use Elasticsearch to implement 'search' functionality from a model containing user-generated data.

Table Of Content

Features

  • Save user posts in database
  • Search for user posts
  • Display relevant search results

Technologies Used

Testing

Unfortunately, the search functionality may not work in the demo link. Payment is required to enable such a service, which at the moment is not really necessary. You can run the application in your local machine to test it out.

  • Clone this repo:

    $ git clone git@github.com:GitauHarrison/search-functionality-in-flask.git
  • Change directory to the cloned repo:

    $ cd search-functionality-in-flask
  • Create and activate a virtual environment:

    $ mkvirtualenv venv # I am using virtualenvwrapper
  • Install project dependencies in your active virtual environment:

    (venv)$ pip3 install -r requirements.txt
  • Update environment variables:

    (venv)$ cp .env-template .env
  • Configure elasticsearch (see reference section below)

  • Run your Flask server:

    (venv) flask run
  • Paste the localhost URL into your favorite browser to access the GUI application

  • Use the search form to query for data

Reference