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

Filtering #4

Closed
guyfedwards opened this issue Dec 28, 2022 · 3 comments
Closed

Filtering #4

guyfedwards opened this issue Dec 28, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@guyfedwards
Copy link
Owner

guyfedwards commented Dec 28, 2022

Newsboat does a lot but I've not worked out how to show tagged/starred articles by category, only by feed... Would love that feature and the ability to sync with Tiny Tiny RSS...

Add searching by text in list, also by source, category.

Options:

  • foo narrows by title
  • foo category:allfoos narrows by title within category
@guyfedwards guyfedwards added enhancement New feature or request help wanted Extra attention is needed labels Dec 28, 2022
@guyfedwards guyfedwards self-assigned this Nov 8, 2023
guyfedwards added a commit that referenced this issue Nov 8, 2023
- sqlite refactor and removal of cache (#5)
- split out rss parsing and test
- add migrations
- add Read for items and h/l navigation through items;
- show/hide read and mark as read (#35)
- open in browser (#8)
- add filtering (#34, #4)
- autoread config option
guyfedwards added a commit that referenced this issue Nov 8, 2023
- sqlite refactor and removal of cache (#5)
- split out rss parsing and test
- add migrations
- add Read for items and h/l navigation through items;
- show/hide read and mark as read (#35)
- open in browser (#8)
- add filtering (#34, #4)
- autoread config option
@guyfedwards
Copy link
Owner Author

Filtering by title added in #v2.0.0

@kanielrkirby
Copy link
Contributor

@guyfedwards I'd love to help contribute this feature (namely, the filtering by feed name), as I use nom quite often.

Some thoughts I'd like to run by you. Glancing through the code for charmbracelet/bubbles/list, it seems that the main way I could see this working is by overriding the default FilterFunc on the list. For example:

func CustomFilter(term string, targets []string) []list.Rank {
      // split term into FeedName and Title, exclude targets that don't include FeedName

/*    This is the default code, copied from bubbles/list
	ranks := fuzzy.Find(term, targets)
	sort.Stable(ranks)
	result := make([]list.Rank, len(ranks))
	for i, r := range ranks {
		result[i] = list.Rank{
			Index:          r.Index,
			MatchedIndexes: r.MatchedIndexes,
		}
	}
*/

	return result
}

// in initialization
l := list.New()
l.Filter = CustomFilter

And then changing the TUIItem.FilterValue() to also include the string for the FeedName:

func (i TUIItem) FilterValue() { return i.FeedName + "some_delimiter" + i.Title }

This is using the standard bubbles/list functionality. I'd definitely like to hear your thoughts on this, and if there are any other filters you really want to add, or if you'd like this to be the primary one.

Thanks for all your hard work!

@guyfedwards
Copy link
Owner Author

Hey @kanielrkirby, yea that's along the same lines I was thinking. Would be happy to review anything if you want to implement.

The initial functionality can just be a text search and later down the line add categories etc once the core function is fleshed out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants