Skip to content

Conversation

@ReverM
Copy link
Contributor

@ReverM ReverM commented Jan 19, 2026

Issue

https://otwarchive.atlassian.net/browse/AO3-5367

Purpose

This makes it so it is impossible to search for hidden (via unrevealed) information with bookmarks by making the json returned for the bookmarked item be empty if the item is unrevealed.

Credit

Danaël / Rever ( they / he )
Danaël Villeneuve on jira

@ReverM
Copy link
Contributor Author

ReverM commented Jan 19, 2026

To note, this will require reindexing

@Bilka2
Copy link
Contributor

Bilka2 commented Jan 20, 2026

Could you explain why it doesn't work to use a filter in the bookmarkable query similar to hidden_filter?

# Exclude items hidden by admin from bookmarkable search results.
# Note that this is used as an exclusion filter, not an inclusion filter, so
# the boolean is flipped from the way you might expect.
def hidden_filter
term_filter(:hidden_by_admin, "true")
end

@ReverM
Copy link
Contributor Author

ReverM commented Jan 20, 2026

Could you explain why it doesn't work to use a filter in the bookmarkable query similar to hidden_filter?

# Exclude items hidden by admin from bookmarkable search results.
# Note that this is used as an exclusion filter, not an inclusion filter, so
# the boolean is flipped from the way you might expect.
def hidden_filter
term_filter(:hidden_by_admin, "true")
end

This will work for making sure we cannot search using the information on the work that is not visible. However, this would also make it so that it is impossible to search for the visible information on the bookmark. The second step of the added test would fail as this would just exclude every bookmark that is of an unrevealed bookmarkable.

Copy link
Contributor

@Bilka2 Bilka2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the explanation! I reconfirmed that we indeed want to keep the bookmarks themselves searchable, so this current approach is good

For the reindexing, this doesn't change the mapping so we we don't need to rebuild the whole index. So, ideally we would update only the bookmarkables that are unrevealed works, without needing downtime. Could you add a rake task that does that? reindex_hidden_unrevealed_tags is an example of a similar task

@Bilka2 Bilka2 changed the title AO3-5367 Bookmarks of unrevealed appear in search results AO3-5367 Bookmarks of unrevealed works appear in search results Jan 25, 2026
Copy link
Contributor

@Bilka2 Bilka2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the reindexing, this doesn't change the mapping so we don't need to rebuild the whole index. So, ideally we would update only the bookmarkables that are unrevealed works, without needing downtime. Could you add a rake task that does that? reindex_hidden_unrevealed_tags is an example of a similar task

@ReverM
Copy link
Contributor Author

ReverM commented Jan 26, 2026

For the reindexing, this doesn't change the mapping so we don't need to rebuild the whole index. So, ideally we would update only the bookmarkables that are unrevealed works, without needing downtime. Could you add a rake task that does that? reindex_hidden_unrevealed_tags is an example of a similar task

Oh sorry about that. It totally slipped out of my mind. Going to do this today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants