Ranchero-Software / NetNewsWire

RSS reader for macOS and iOS.
https://netnewswire.com/
MIT License
8.42k stars 532 forks source link

Search by author field not working #4003

Open tylerbenson opened 1 year ago

tylerbenson commented 1 year ago

Some feeds are a combination from many authors. I want to be able to filter a feed to a specific author. I expected search to work, but this only applies to the content of the post, not the author.

For example, searching the inessential feed for "Simmons" only shows one post. image

That feed only has a top level author so it is a poor example of my use case. An atom feed I subscribe to has individual dc:creator tags per post.

stuartbreckenridge commented 1 year ago

I get the same results when testing with @brentsimmons' inessential.com feed. However, that's because—as you said—that feed has a top-level author and not a per-item author.

Testing with sixcolor's feed and searching by author works for me. In the example below, I am searching for Jason Snell, and the first article has him as the author, and his name is not in the article text.

All Articles

Full Feed

Filtered

Filtered for one Mr. Jason Snell

If you have feeds where things are potentially misbehaving, please let me know.

tylerbenson commented 1 year ago

I'm not sure how to get the raw xml feed for that feed for comparison.

Here's an example feed with many different authors that doesn't allow filtering in this way: https://notabird.site/i/lists/1348435279527333889/rss

Thanks for looking into it.

stuartbreckenridge commented 1 year ago

Ah, I think I see it.

@brentsimmons If I'm reading things correctly, we are only searching article content?

func fetchArticlesMatching(_ searchString: String) throws -> Set<Article> {
        var articles: Set<Article> = Set<Article>()
        var error: DatabaseError? = nil

        queue.runInDatabaseSync { (databaseResult) in
            switch databaseResult {
            case .success(let database):
                articles = self.fetchArticlesMatching(searchString, database)
            case .failure(let databaseError):
                error = databaseError
            }
        }

        if let error = error {
            throw(error)
        }
        return articles
    }
tylerbenson commented 1 year ago

Perhaps the select statement could be updated to search Article.authors too?

tylerbenson commented 1 year ago

Actually, a better approach -- it looks like the search virtual table could be updated to include authors, then the select statement mentioned previously would probably be fine.