Code base for MATRIX website
-
Clone or download the repository.
-
Create a new virtual environment for the project.
virtualenv venv source venv/bin/activate
-
Install required python libraries giving in the requirements.txt file.
pip install -r requirements.txt
-
Run Django migrations.
python manage.py makemigrations python manage.py migrate
-
Populate database with names from list.txt
python populate_db.py
-
Perform bulk indexing of data.
- Download elasticsearch and activate it.
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.tar.gz tar -xzf elasticsearch-5.1.1.tar.gz ./elasticsearch-5.1.1/bin/elasticsearch
- Using another terminal (let elasticsearch run in the background), activate the virtualenv and go into the Django shell for bulk indexing of data.
python manage.py shell from movie.search import * bulk_indexing()
- To confirm bulk indexing of data quit the shell and run the following curl command.
curl -XGET 'localhost:9200/movie-index?pretty'
- In case of Invoke-WebRequest error, run this command and try again.
remove-item alias:\curl
-
To test out the search functionality run the following commands in the shell.
python manage.py shell from movie.search import * print(search(name="<movie name>")) # use 'thor', for example.
- The response should be something like this.
<Response: [<Hit(movie-index/doc/AWXKb2DCkOlAI_7rRErW): {u'release': u'thor', u'name': u'thor'}>, <Hit(movie-index/doc/AWXKb2DVkOlAI_7rRErX): {u'release': u'thor', u'name': u'thor'}>]>
-
Start the application.
python manage.py runserver