Conversation
| export async function search (queryString, options) { | ||
| const searcher = new Search(); | ||
|
|
||
| const articles = await getInput(options); |
There was a problem hiding this comment.
GitHub isn't allowing me to comment on the collapsed parts of the code but the error would occur at line 74 within the getInput() function when executing JSON.parse(). It wasn't reading the combined JSON file with all the preprint data correctly.
| const combinedOptions = { | ||
| output: COMBINED_FILE | ||
| }; | ||
| sendOutput(combinedData, combinedOptions); |
There was a problem hiding this comment.
I think I fixed the issue, I realized I was missing await in front if the async function sendOutput() here. The error doesn't come up anymore, I'm assuming what happened was the JSON file that combined the BiorXiv and MedrXiv preprint info wasn't finished populating the data before the keyword search started.
Codecov Report
@@ Coverage Diff @@
## main #29 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 2 2
Lines 106 106
=====================================
Misses 106 106 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
|
|
||
| // Getting all latest articles from BiorXiv | ||
| console.log(`Fetching from ${BIORXIV_SOURCE} between ${START_DATE} and ${END_DATE}`); | ||
| fs.open(BIORXIV_FILE, 'w', function (err, file) { // consider changing the callback function if needed |
There was a problem hiding this comment.
All of these fs.open calls (1) are never used (2) are passed a callback that doesn't do anything. Remove?
There was a problem hiding this comment.
| if (err) throw err; | ||
| console.log('Saved!'); | ||
| }); | ||
| const combinedData = { |
There was a problem hiding this comment.
If you're intending on concatenating two arrays bioData and medData this destructure isn't doing that. In fact it breaks the search, which expects an array.
| }; | ||
| console.log(`Searching for ${QUERY}`); | ||
| const searchHits = await search(QUERY, outputOptions); | ||
| const numSearchHits = Object.keys(searchHits).length; |
There was a problem hiding this comment.
search looks like it returns an empty Promise - so I would expect searchHits to resolve to undefined.
Currently I'm experiencing issues with keyword searching through the JSON file that combines BiorXiv & MedrXiv preprints from the past day. I'm getting an error that says "SyntaxError: Unexpected end of JSON input", I'll add more details through code comments.