Skip to content

Feedgen: Efficient Querying of Keyword Based Feeds #91

@rudyfraser

Description

@rudyfraser

Is your feature request related to a problem? Please describe.

Communities such as BlackskyTravel or the Haiti feed would like to be hosted by Blacksky and leverage the features of rsky-feedgen but at the moment are quite slow to load and create a poor experience in-app. Doing something select * from post where post."text" like '%{keyword}%' takes a long time.

Describe the solution you'd like

Some improvement or optimization that makes it easy to query and return posts for a bsky feedgen based on a provided set of keywords (could be regex, etc.)

Describe alternatives you've considered

The following is how it's implemented today trying to use hashtags:

            // Adjust the filtering logic
            if hashtags.is_empty() {
                // No hashtags provided, include only posts where author is in the list
                query = query.filter(MembershipSchema::did.is_not_null());
            } else {
                let hashtag_patterns: Vec<String> = hashtags
                    .iter()
                    .map(|hashtag| format!("%#{}%", hashtag))
                    .collect();
                query = query.filter(
                    MembershipSchema::did
                        .is_not_null()
                        .or(PostSchema::text.ilike(any(hashtag_patterns))),
                );
            }

Additional context

Having this would allow us to bring on board more community based feeds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions