- setting
SEARCH_ALL_VISIBLE_TOOTS=true
in your instance config will let users search all non-private posts, not just the ones they've interacted with. - prefixing a search query with
π
will use ES simple query string syntax instead of Mastodon's weird broken subset of it, which will let you use "double quotes" for literal strings including white space, + to force a term to be included, or - to force a term to be excluded. - prefixing a search query with
π
will use ES regular query string syntax which is like simple query syntax, except:- syntax errors will cause the search to fail, so if you don't get anything back, that's why.
- you can specify individual fields to match on. if you don't specify a field for a given search term, it does a normal full-text search for it.
- for example,
π macOS acct:vyr
, if run by a demon.social user, would find all the times i complained about Apple's desktops.
- for example,
- the most useful one is
acct
, which is a username for users on the current instance and ausername@domain
for users of any other instance. username
is the part before the@
, such asvyr
domain
is the part after the@
, such asdemon.social
. note that this is set for both local and remote users, so you can search for posts from your own instance.created_at
is a date field used for sorting posts by date as described below.
- following
π
orπ
immediately withπ
orπ
will sort the results by oldest to newest or newest to oldest respectively
take an instance VM snapshot or whatever. or don't, i'm not your mom.
cd your/mastodon/checkout/directory
git apply path/to/mastodon-advanced-search.patch
Add this line to your .env.production
config file:
SEARCH_ALL_VISIBLE_TOOTS=true
sudo systemctl restart mastodon-web.service
add the new index fields to ES so you can filter by user and sort by date. you only need to do this once. it's supposed to be zero downtime, although it will burn a lot of disk and CPU as it goes through every post on your server again. consequentially, it'll take a while, so run it in tmux
or whatever you use to keep long-running one-off jobs from dying when you close the terminal.
# you need this gem to do fast reindexing
bundle add parallel
RAILS_ENV=production PROGRESS=true bin/rake 'chewy:parallel:reset[statuses]'
note that this results in the statuses
index becoming an alias backed by the newly reindexed data in a new index named something like statuses_1615749400942
(appending the current date), as an artifact of Chewy zero-downtime reindexing. shouldn't change how anything works, but if it annoys you, you can invoke the ES reindex or clone APIs (depending on version) to copy the new index back to statuses
. this is entirely optional.
Almost entirely superseded by VyrCossont/mastodon#2