RedReader
RedReader copied to clipboard
Filter posts
this fixes https://github.com/QuantumBadger/RedReader/issues/646 and allows to specify a comma separated list of keywords which will be used to filter posts by title.
In the future of course regex or filter based on user flairs can be integrated.
Thanks for this! I've left a few minor comments, although I'm not sure I'd want to merge this in its current form.
Currently it's just doing a title.contains(keyword) to check if it matches, but that's not really sufficient as the keyword could be part of some other word in the title. For example, adding the word "trump" to the filter will filter out the word "trumpet", "trumping", etc. In other words this falls foul of the Scunthorpe problem.
I guess we'd want to split titles by punctuation/whitespace and check for matches that way?
I guess we'd want to split titles by punctuation/whitespace and check for matches that way?
It could be a phrase, like long series/book/etc title
thank you for having a look at the PR. yes you are absolutely right, i changed it so that the keywords are matched against complete words (using \W+, which matches one or more non-word characters (punctuation, whitespace, etc.))
I also resolved the aforementioned reviews apart from the refactoring, as i am unsure how you would like this to be done. i guess it would be good to refactor the whole class then and also make all the other conditions separate methods/classes.
Very nice. I see you put the option in Settings -> Behaviour -> Posts. I would instead suggest creating a whole new settings item, Settings -> Filters. Here we could then simply add more filters later (by Post domain, keyword, and Comment keyword etc. pp). Makes it easier to find and access in my opinion.
no problem i modified the PR to introduce a new settings category
i think this can be merged no?
While I appreciate the contribution, I've decided to close this PR as I'm not happy with most aspects of the implementation:
- UI: I don't think that a text box with a comma separated list is a good user experience. I'd like to make a proper list editing UI for this in Compose.
- Storage: shared prefs aren't a great choice for this -- we've run into issues with blocked subreddits where the pref string gets truncated due to being too long. I'd like to store this in an actual database, and I'm working on some changes which will improve how data is persisted in RedReader in general.
- Filtering mechanism: I think this needs some more thought (and maybe more flexibility for the user).
- Inefficiency: this is a minor point, but the code in this PR is needlessly inefficient (repeatedly calling
Arrays.asList(titleWords)for every keyword in the list even thoughtitleWordsdoesn't change, repeatedly callingkeyword.trim()for every post/keyword combination even though the list of keywords doesn't change, leading ton^2string allocation for no reason, etc).
Again, I'm grateful for the PR, but I'd rather implement this properly first time rather than have to redo it in future and migrate the preference data. I know that lots of people want this feature, so I'm planning to work on it myself, making use of the upcoming storage changes, and the new Compose UI work.
you raise some valid points so it is understandable. i hope you can reuse some of the ui elements at least so it was not for nothing :)
I've been using this and my Reddit experience has been so much better. Looking forward to seeing it in an official capacity but thanks for your work on this, being able to filter stuff out is a godsend.
This would be useful in the next "REDACTED said this" , "REDACTED said that" few years.
Are there any plans to implement this soon? It's sorely needed in today's climate. I was very surprised it's not already a feature. I'll come back to redreader once there's some kind of title filtering.
last time any activity from @QuantumBadger was when he replied to this. it's nearly 6 months now, hopefully everything is alright. i also wish this would be implemented, maybe i will need to use my own fork from now.