feature(#164046262): Users should be able to search for articles #56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds custom filtering and search functionality. A user can be able to perform partial and full word searches depending on the
search string
he/she wants to search. This feature also enables the user to filter his/her search depending on the specific fields he/she wants to search. Currently, the fields that the user can search from areauthor
,tags
,title
,description
andbody
. In order for a user to search, he/she should use the following endpoint:PUT /api/articles/user/search/ - Searches for all articles with the given search string
For the data pass the following dictionary and set
value
to be your search string:{"search_string": <value>}
To filter by field the URL is as shown below, for the fields listed above:
PUT /api/articles/user/search/?query=tags - Filters for all articles with the given search string in the tag_list attribute
To filter multiple fields at the same time add the fields separated by commas as shown below:
PUT /api/articles/user/search/?query=tags,author,body,description - Filters for all articles with the given search string in the tag_list attribute
Type of Change
Checklist
Related Stories
Add search functionality and custom filtering