This commit was supposed to implement the functionality for authorsFilter, videosFilter, linksFilter:
|
- `QueryArticles` class. Added filters `authorsFilter`, `videosFilter`, `linksFilter` |
But when cross-referencing with the python sdk it seems the flag seems to be different: hasAuthorsFilter, hasVideosFilter, hasLinksFilter, etc. as referenced here:
https://github.com/EventRegistry/event-registry-python/blob/bf3ce144fa61cc195840591bae5ca88b31ca9139/eventregistry/QueryArticles.py#L192
This implementation of the python sdk works. But using the same flags in the node.js implementation fails. Can you please fix this and update and release a newer version to npm registery asap?
Here is a simple example to reproduce this:
import dayjs from "dayjs"
import {
QueryArticles,
RequestArticlesInfo,
ReturnInfo,
ArticleInfoFlags,
EventRegistry,
} from "eventregistry"
const er = new EventRegistry({ apiKey: API_KEY})
async function main() {
const query = new QueryArticles({
conceptUri: "http://en.wikipedia.org/wiki/In_vitro_fertilisation",
dateStart: dayjs().subtract(1, "day").format("YYYY-MM-DD"),
dateEnd: dayjs().format("YYYY-MM-DD"),
authorsFilter: "keepOnlyIfHasAuthors", // DOES NOT WORK
hasAuthorsFilter: "keepOnlyIfHasAuthors", // DOES NOT WORK
})
query.setRequestedResult(
new RequestArticlesInfo({
page: 1,
count: 100,
returnInfo: new ReturnInfo({
articleInfo: new ArticleInfoFlags({ body: false }),
}),
})
)
const response = await er.execQuery(query)
const articles = response.articles.results
const withAuthors = articles.filter((a: any) => a.authors?.length > 0)
const withoutAuthors = articles.filter((a: any) => !a.authors?.length)
console.log("=== Articles ===\n")
for (const article of articles) {
const authors = article.authors?.length
? article.authors.map((a: any) => a.name).join(", ")
: "No authors"
console.log(`${article.uri} — ${authors}`)
}
console.log("\n=== Summary ===")
console.log(`With authors: ${withAuthors.length}`)
console.log(`Without authors: ${withoutAuthors.length}`)
console.log(`Total: ${articles.length}`)
}
main()
This commit was supposed to implement the functionality for
authorsFilter,videosFilter,linksFilter:event-registry-node-js/CHANGELOG.md
Line 15 in 996c9de
But when cross-referencing with the python sdk it seems the flag seems to be different:
hasAuthorsFilter,hasVideosFilter,hasLinksFilter, etc. as referenced here:https://github.com/EventRegistry/event-registry-python/blob/bf3ce144fa61cc195840591bae5ca88b31ca9139/eventregistry/QueryArticles.py#L192
This implementation of the python sdk works. But using the same flags in the node.js implementation fails. Can you please fix this and update and release a newer version to npm registery asap?
Here is a simple example to reproduce this: