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.
Fixed following test cases in golang server
Test 2: Expects results for the case-sensitive query.
The suffixarray package indexes the words as we passed. To ensure case insensitivity, I converted the entire doc to lowercase before passing it to the index function. Additionally, I converted the query string to lowercase before calling the lookup function to avoid any case-sensitive failures.
Test 3: Expects 20 results for the query
drunk
.The suffixarray package returns the complete list of indexes it matches. To restrict the output to the first 20 results, I included a constant with a value of 20 and returned the subset if the indexes had more than 20 results.
Fixed following test cases in JS
Test 3: Expects load more to append results.To enable
load more
, I have received a page number from the client and implemented pagination logic on the server side. The page number will be reset when the client initiates a new search and will automatically increment each time the "load more" function is triggered.