-
Notifications
You must be signed in to change notification settings - Fork 5
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
Created posts search function in new file src/topics/search.js #38
Created posts search function in new file src/topics/search.js #38
Conversation
Pull Request Test Coverage Report for Build 11051124241Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
…test code in test/topics.js
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.
All good! Ready to complete the other tasks.
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.
Great work! Approved.
This pull request addresses the sub-issue #42 of issue #20 relating to back-end code for User Story 3 (post search functionality). Later commits also address the other sub-issue #43 concerning testing.
Using the user search implementation in src/user/search.js as a guide, I made a new file src/topics/search.js and added search function Topics.search.
Topics.postSearch function: takes user input
data
(which is an object containing thequery
or search word,tid
which is the topic id, anduid
), and returns an object that containsmatchCount
the number of filtered posts,posts
an array of post arrays containing the filtered posts found,timing
the time it took to search, and thepageCount
of the search result.Already-exisitng functions utilized:
getTopicPosts: in src/topics/posts.js, returns an array of arrays of post objects belonging to a topic.
getTopicData: in src/topics/data.js, returns the fields of a topic object like tid (topic id).
Both essential for a posts searching mechanism.
Addressing progress in testing (sub-issue #43): test code has been written, however, repeatedly faced error of "topics.postSearch is not a function", will resolve in sprint 2.