EventRegistry / event-registry-node-js

Node.js package for API access to news articles and events in the Event Registry
MIT License
13 stars 2 forks source link

ComplexArticleQuery ignores arguments #1

Closed joelhulen closed 6 years ago

joelhulen commented 6 years ago

When I pass in arguments to the ComplexArticleQuery object, they appear to be ignored. I am trying to skip duplicate articles.

The ComplexArticleQuery class in query.ts appears to only set the $filter value if it is empty:

/src/query.ts#L198

if (_.isEmpty(filter)) {
    this.queryObj["$filter"] = filter;
}

I believe this should probably be changed to:

if (!_.isEmpty(filter)) {
    this.queryObj["$filter"] = filter;
}

This is how I'm currently passing in my arguments from my application:

    const cq = new erBase.ComplexArticleQuery(combinedQueryBase, {
      isDuplicateFilter: 'skipDuplicates',
      hasDuplicateFilter: 'keepAll',
      eventFilter: 'keepAll'
    });
    const q = erBase.QueryArticles.initWithComplexQuery(cq);

Despite setting isDuplicateFilter: 'skipDuplicates', I still receive duplicate articles.

Can you please validate whether I am doing something wrong, or if this is a bug as I have outlined?

UnspokenMallard commented 6 years ago

@joelhulen You are right, it is a bug. This issue is fixed with the latest version (1.0.91).

joelhulen commented 6 years ago

Thank you for the quick resolution! It appears to have worked :)