# 构建主题索引

**URL:** https://meta.discourse.org/t/building-an-index-from-topics/285694
**Category:** Feature
**Created:** [2023年十一月16日 09:54 UTC](https://meta.discourse.org/t/building-an-index-from-topics/285694 "2023-11-16T09:54:49Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Ralf\_Stockmann](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ralf_stockmann/32/505867_2.png) [@Ralf\_Stockmann](https://meta.discourse.org/u/Ralf_Stockmann)
#### Post date: [2023年十一月16日 09:54 UTC](https://meta.discourse.org/t/building-an-index-from-topics/285694/1 "2023-11-16T09:54:49Z")

</div>

我们想为所有带有特定标签的主题创建一个“A-Z”索引页面。在数据浏览器中，针对字母“D”和标签“index”的查询将如下所示：

```plaintext
SELECT 
    t.id,
    t.title,
    t.created_at
FROM 
    topics t
JOIN 
    topic_tags tt ON t.id = tt.topic_id
JOIN 
    tags tg ON tt.tag_id = tg.id
WHERE 
    t.title ILIKE 'D%' 
    AND tg.name = 'index'
ORDER BY 
    t.title ASC; -- 按标题字母升序排序

```

是否有办法在通用搜索中实现这一点，以便我可以在帖子中使用它作为 URL？例如，查询 `in:title D%` 返回所有标题中 _某处_ 包含“D”的主题，而不仅仅是标题开头的“D”。

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [2023年十一月16日 17:47 UTC](https://meta.discourse.org/t/building-an-index-from-topics/285694/2 "2023-11-16T17:47:41Z")

</div>

我认为您可以通过实验性过滤器功能来实现这一点：

> [@Experimental topics list filter feature](https://meta.discourse.org/t/experimental-topics-list-filter-feature/263641):
>
> We have recently introduced an innovative [/filter](https://meta.discourse.org/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](https://meta.discourse.org/t/custom-sidebar-sections-being-tested-on-meta/255303) within the sidebar. How to turn it on Enable the experimental\_topics\_filter site settings in the admin i…
