Experimental topics list filter feature

We have recently introduced an innovative /filter route, enabling more sophisticated filtering of the topics list. Significantly, this marks the initial step towards a unified topic filtering language for both search and filtering. Additionally, the dedicated route for topic list filtering enhances the customizability of the sidebar, as users can now incorporate links as custom section links within the sidebar.

How to turn it on

Enable the experimental_topics_filter site settings in the admin interface.

How it works

The /filter has an input field which users can input a query string to filter through the list of topics.

As an example, category:documentation tag:how-to+email will filter for topics that are in the documentation category tagged with both how-to and email.

Currently this is the list of filters that are supported:

status:open topics that are not closed or archived
status:closed topics that are closed
status:public topics that are not read restricted (eg: belong to a secure category)
status:archived topics that are archived
status:unlisted topics that are not visible
status:listed topics that are visible
status:deleted topics

in:pinned topics that are are pinned (either global or per category pins)
in:watching stuff I am watching - supports (muted,normal,tracking, watching_first_post): allow for filtering down to stuff your are tracking, watching etc. - multiple values can be comma separated
in:bookmarked stuff I’ve bookmarked

category:bug topics in the bug category AND all subcategories
=category:bug topics in the bug category excluding subcategories
category:documentation:admins topics in the admins subcategory of documentation
category:bug,feature topics in the bug or feature category including all subcategories
=category:bug,feature topics in the bug or feature category excluding all subcategories
-category:bug,feature excluding topics in the bug or feature category including all subcategories
-=category:bug,feature excluding topics in the bug or feature category only excluding all subcategories
categories: alias for category

tag:bug+feature topics tagged both bug and feature
tag:bug,feature topics tagged either bug or feature
-tag:bug+feature excluding topics tagged bug and feature
-tag:bug,feature excluding topics tagged bug or feature
tags: alias for tag

created-by:@USERNAME topics created by a specific user

posts-min:X topics with X or more amount of posts
posts-max:X topics with no more than max posts
posters-min:X topics where at least X different users have posted
posters-max:X topics where at most X different users have posted
likes-min:X topics with X or more number of likes
likes-max:X topics with no more than X number of likes
likes-op-min:X topics with first post that has X or more number of likes
likes-op-max:X topics with first post that has no more than X number of likes
views-min:X topics with X or more number of views
views-max:X topics with no more than X number of views

activity-before:YYYY-MM-DD topics with latest bump before specified date
activity-after:YYYY-MM-DD topicslatest bump after specified date
created-before:YYYY-MM-DD created before specified date
created-after:YYYY-MM-DD created after specified date
latest-post-before:YYYY-MM-DD latest post created before specified date
latest-post-after:YYYY-MM-DD latest post created after specified date

order:activity order by bump date desc
order:latest-post order by latest post creation desc
order:created order by topic creation desc
order:views order by topic views desc
order:likes order by number of likes in the topic desc
order:likes-op order by number of likes in the first post of each topic desc
order:posters order by number of people who have posted desc
order:category order by category name
order:ANY-asc flip order on results so it is ascending

Feedback

We would love to find out from the community here if this feature will be valuable for your own community and would also like to know how you’re using it.

If there are any filters that you feel like will help you with your needs, do let us know as with with examples of what you are trying to do.

Finally, we want to highlight that this is a very early version of the feature and it is still considered experimental at this point. The user experience needs improvement and we are currently working on adding some sort of inline autocomplete or even an interface to allow users to build out a topics filtering query language without having to remember all the filters by heart.

16 Likes

What did I miss…?
It doesn’t look like it returns topics that are in the bug category tagged with both chat and #pri-high .

1 Like

I don’t think you should be able to see the priority tags. They’re just for us. :shushing_face: :slight_smile:

Does it work if you don’t include it?

2 Likes


Looks like if I remove this tag it doesn’t work either


update: the “alias” works perfectly.

2 Likes

Sorry I just realised my PR to add support for the tag: alias was not merged.

It has now been merged so the tag: alias should work soon.

4 Likes

Another problem: tags filter currently don’t support non-ASCII characters, such as Chinese.

Example: tags:一个不存在的标签 returns every topics, but tags:a-non-existent-tag returns nothing, as expected.


I checked the source, it’s caused by

    value.scan(
        /\A(?<tag_names>([a-zA-Z0-9\-]+)(?<delimiter>[,+])?([a-zA-Z0-9\-]+)?(\k<delimiter>[a-zA-Z0-9\-]+)*)\z/,
3 Likes

Kudos for the nice work @tgxworld . This opens up multiple possibilities.

Just curious to know if it could provide a contextual filtering option ?

For eg. If I select announcements category from sidebar, can we show the filter panel (the new one you have created) at the top to filter by multiple tags (chat, new-feature) within the category.

Currently one cannot filter by multiple tags as an end user intuitively - manually we have to use /tags/interesection/chat/new-feature endpoint. End users may not be aware of this possibility especially to do it within a category.

4 Likes

O good catch. I have a fix for tags in

The category filter will need a similar fix but it is slightly more complicated. I should have it completed by next week.

3 Likes

There’s a missing translation string when a new topic appears in /filter:

[en.topic_count_all count=1]

4 Likes

The feature sounds solid and will definitely help building better & customized feeds of topics for our users! Thank you!

Meanwhile I have a question if this feature allows us to approach embedding latest posts from across multiple topics within specific categories/tags?

1 Like

No, that’s not currently part of the plan here, I don’t think.

If you give the current feature a try as is and still find this is something you’d like to be able to do, can you start a new topic about it with a bit more detail about what you’re thinking?