be_app
has the backend projectfe_app
has the frontend project- I used mongo Mongodb Atlas because i had no space to install mongodb :D
- The tests are for the backend on the tests folder
- I used inverted index algorithm for searching.
- I used very simple algorithm for this task:
1- Mainly I fetch all products in the begging of the server run
2- For every product I split the description and title to words, you can see the logic for this insplit_words
3- Then I convert each word into singular usinginflect
library and save it to a dictionary with the object id of the product, so it the dictionary will look like this4- When i get new sentence for search i split it again using{ 'black': [ObjectID(123), ObjectID(11)], 'hat': [ObjectID(11)] ... }
split_words
then i search for each word in the dictionary.
5- I merge all of these results and then query the DB with these object IDs
This can be improved in several ways, for example I am not doing ranking right now, i just get all results.
also we can convert all nouns with same meaning to abstract word for example: shade and shadow
there is alot more into techniques for improving search results.
For backend:
python3 -m venv intelistyle_env
source intelistyle_env/bin/activate
cd be_app
pip install -r requirements.txt
DATABASE_ADMIN_PASSWORD=admin_user_123123 flask run --host=0.0.0.0 --port=5010
for test run
DATABASE_ADMIN_PASSWORD=admin_user_123123 pytest -s
For frontend:
cd fe_app
npm install
npm start