继续讨论 Topic Checkboxes - a dynamic check list showing all checkboxes from all topic messages:
要提取特定类别中所有带有未选中复选框的帖子,包括摘录(即包含该复选框的段落),应该使用什么样的 SQL 查询?
继续讨论 Topic Checkboxes - a dynamic check list showing all checkboxes from all topic messages:
要提取特定类别中所有带有未选中复选框的帖子,包括摘录(即包含该复选框的段落),应该使用什么样的 SQL 查询?
这样可以吗?
-- [params]
-- int_list :categories
SELECT p.id post_id,
t.id topic_id,
c.id category_id,
(regexp_matches(p.raw, '\\[\\s\\]\\s*[^]\\r\\n]+', 'g'))[1] AS html$excerpt
FROM posts p
JOIN topics t ON p.topic_id = t.id
JOIN categories c ON t.category_id = c.id
WHERE p.raw ~ '\\[\\s\\]\\s*[^]\\r\\n]+'
AND c.id IN (:categories)
也许我有什么地方理解错了,但我认为这会是一个不错的起点。
所以复选框只是消息中的普通文本,例如 []、[ ]、[*] 等?
没错。 ![]()
不过,如果您使用 cooked 而不是 raw,您会看到它们被转换为图标。我不确定那是否更容易搜索?