Api to search indian banks or branches.
The project uses native full text faetures provided by postgresql. There are two types of full text search
The second full text search ranks the results on the basis of the rank provided by postgres for each result. Greater the rank higher the result will be in result.
For optimizing search queries I have used GIN indexes over the search column. This made my queries run 2x faster. It's simple to create a GIN index.
CREATE INDEX INDEX_NAME ON TABLE_NAME USING GIN(COLUMN_NAME)As per postgres docs gin indexes are 2-3x faster than other indexes available in postgres ( GIST and Btree) but uses more space.
Also I added a trigger to db which will automatically generate a search vetor on any insert or update query
SECRET_KEY
DB_NAME
DB_HOST
DB_USER
DB_PASSWORD
REDIS_HOST
REDIS_PASSWORD
DEBUG
psql psql -h DB_HOST -p DB_PORT -U DB_USER -d DB_NAME -f FILENAME.sqlYou can get the sql file from the above repo
python mange.py makemigrations
python manage.py migrate
python manage.py runserver
python manage.py test
SetUp a local postgres instance for testing and add the credentials in settings.py
/api/branches/autocomplete/?q=<search_tern>&offset=<page_number>&limit=<page_size>
Autocomplete endpoint, searches over the branch column of branches table and returns the result.
/api/branches/search/?q=<search_term>&city=<city_name>&offset=<page_number>&limit=<page_size>
Searches all the db columns in bracnes table in the given city with the given search term.
/api/banks/:id
Returns bank with id :id from the banks table.
Freebie Stuff ??♀️?♀️
All these things are included in AWS Free tier but i don't want to share my card details ? ( I don't have a card ?).
I really enjoyed creating this project and learend lot's of new things while creating it.
P.S Today (21 May, 2021) is my bithday ?