-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#161967026 Add Custom Search Functionality #24
#161967026 Add Custom Search Functionality #24
Conversation
authors/apps/search/models.py
Outdated
@@ -0,0 +1,2 @@ | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line at end of file
authors/apps/search/admin.py
Outdated
@@ -0,0 +1 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line at end of file
authors/settings.py
Outdated
# is updated | ||
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor' | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line at end of file
authors/apps/articles/serializers.py
Outdated
@@ -1,10 +1,11 @@ | |||
from rest_framework import serializers | |||
|
|||
from authors.apps.authentication.serializers import UserSerializer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'authors.apps.authentication.serializers.UserSerializer' imported but unused
fd14f3a
to
8a815aa
Compare
8a815aa
to
0beb9d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well illustrated and to the point. Works as expected. LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would have been great if we had a test that verifies that searching for a particular
item will return that item
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
- write unit tests for search endpoints - update requirements with search dependencies - add search application with a search index,filter ans serializer - configure search backend indexing in settings.py - update the documentation [Finishes #161967026]
0beb9d8
to
e1042f1
Compare
What does this PR do?
Add the search and filter functionality
Description of Task to be completed?
update requirements.txt with search engine requirements by introducing Django-filter, haystack and whoosh. This provides two search approaches ie filtering results using Django-filter and building and searching the index using haystack and whoosh.
Filter
GET /api/articles/q/filter/< ?param=value¶m2=value >
The filter backend provides filter by the following parameters:
Search
GET /api/articles/q/search/?
The search endpoint employs the Whoosh backend to index the articles to provide
faster search and more search parameters:
all the above parameters take the following additional options as
parameter__option
orparameter__not_option
How should this be manually tested?
git clone https://github.com/andela/ah-jumanji.git
cd ah-jumanji
git checkout ft-add-search-filtering-functionality-161967026
virtual environment
and activate itpip install -r requirements.txt
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
pytest -v -k "TestSearchFilter"
-- optionally to update the search index
./manage.py update_index --settings=authors/settings
Any background context you want to provide?
The search method employed offers a search engine to index the articles and improve search efficiency . This is faster and more scalable. The choice of whoosh is informed by its pure python nature hence it does not require additional dependencies.
The search index is updated in real-time as the database is updated. This can how be made more efficient by employing a key value memory store like Redis mq.
What are the relevant pivotal tracker stories?
#161967026
Screenshots (if appropriate)
Checklist: