Skip to content
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

The negation rule doesn't work as expected. #13

Open
imjoeyli opened this issue Jan 7, 2023 · 6 comments · May be fixed by #15
Open

The negation rule doesn't work as expected. #13

imjoeyli opened this issue Jan 7, 2023 · 6 comments · May be fixed by #15
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@imjoeyli
Copy link

imjoeyli commented Jan 7, 2023

It seems that when the negation rule (!# or !~) is present along with other positive rules (# or ~), it doesn't work as expected.

The filter seems to ignore the negation rule's previous "<feed>" that should be matched, causing all feeds to be applied with the negation rule, resulting in those that should not be filter being marked as read.

By the way, I would like to know how to change the log-level to debug, now $ docker-compose logs app doesn't show the related logs.

@imjoeyli
Copy link
Author

imjoeyli commented Jan 7, 2023

For testing purposes, my killfile rules are as follows.

ignore-article "https://sspai.com/feed" "title !~ (派评|一日一技|看什么|App\+1)"
ignore-article "https://www.macstories.net/feed/" "title =~ (MacStories\sUnwind|Episode\s\d|Club\sMacStories|Kolide)"
ignore-article * "title =~ \[Sponsor\]"

The result is, except for posts after filter inhttps://sspai.com/feed, all posts in other feed are marked as read.

@dewey dewey added help wanted Extra attention is needed good first issue Good for newcomers labels Jan 9, 2023
@dewey
Copy link
Owner

dewey commented Jan 9, 2023

Hey @imjoeyli, thanks for reporting this. I don't currently have time to investigate that, so if you want to give debugging this a shot I'd be happy to review it.

@imjoeyli
Copy link
Author

imjoeyli commented Jan 9, 2023

Hey @imjoeyli, thanks for reporting this. I don't currently have time to investigate that, so if you want to give debugging this a shot I'd be happy to review it.

I'm not a professional, just a self-hosted amateur. But I can learn to have a try.

Would you please tell me how to change the log level to debug?

@dewey
Copy link
Owner

dewey commented Jan 9, 2023

No worries, if you want to change the log level you can set the environment variable MF_LOG_LEVEL=debug. This should get you the desired result.

The code for this is here.

@itohsnap
Copy link

I'm not a Go programmer, so forgive me if I've missed something, but I think the issue is in /filter/service.go:

RunFilterJob() basically loops through all feeds. If a Feed URL contains any (rule) URL, then all unread entries for that feed are passed to evaluateRules(). Notably, if you have any wildcard/"*" (rule) URLs, then every feed will match a rule and all unread entries will be passed to evaluateRules().

evaluateRules(), for each entry, then loops through all rules to see if each rule's Filter Expression applies. If it does, then it returns that the entry should be marked as read.

Critically, evaluateRules() does not consider if each (rule) URL applies to the entry being evaluated.

If I've interpreted this properly, then the issue is actually that all rules are being applied to all unread entries from feeds covered by at least one rule. It just shows up much more dramatically, in general, with negation rules.

(Again, apologies if I'm off in left field.)

--

(Incidentally: line 118 of service.go tests if tokens[1] == "description"... should that be "content", instead? "Description" makes it sound like the rule is testing against the feed's general description, not the content of each entry.)

@dewey
Copy link
Owner

dewey commented Feb 23, 2023

Thanks for doing that investigation, that's a great lead! I'm not sure when I'll have time to take a look at that, but it'll be helpful for that or if someone else picks it up in the meantime.

phofm added a commit to phofm/miniflux-sidekick that referenced this issue Feb 24, 2023
As described by itohsnap (cf. dewey#13 (comment)) all rules of the killfile were being applied to each feed. This clumsy change prevents that by making sure the feed’s URL matches the rule’s URL in `evaluateRules`.

There’s probably a more elegant way of doing this, but I’m not a programmer and simply desperately needed this to work. Maybe someone else can use it. :-)
itohsnap added a commit to itohsnap/miniflux-sidekick that referenced this issue Feb 27, 2023
Fixes dewey#13 - all rules in the killfile were being applied to all feeds that had any rule specified, regardless if a given rule applied to a specific feed.

Also adds the ability to set Filter Expressions involving post authors, and to list Miniflux categories instead of a specific feed URL, in killfiles.
@itohsnap itohsnap linked a pull request Feb 27, 2023 that will close this issue
nalabelle pushed a commit to nalabelle/miniflux-sidekick that referenced this issue May 17, 2023
Fixes dewey#13 - all rules in the killfile were being applied to all feeds that had any rule specified, regardless if a given rule applied to a specific feed.

Also adds the ability to set Filter Expressions involving post authors, and to list Miniflux categories instead of a specific feed URL, in killfiles.

(cherry picked from commit 80f3c3a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants