How to access to the array of watched words and the tags they are mapped to

Thanks so much for the quick response.

Your pointer to bulk operations, " Bulk Tag All Topics Based on a Keyword", is very helpful. And I will use it. To really implement my feature request, however, I would need access to the array of watched words and the tags they are mapped to, so I could loop over them and assign the tags. Probably these are available in the rails console? Maybe there is documentation somewhere for what system variables are available on the console? I tried searching a bit in the sysadmin category; no joy so far.

3 Likes

Let’s say you have a fruit tag that’s applied to all topics that include the words apples or oranges.

You can get an array of the watched words associated with the fruit tag with the following:

cd /var/discourse
./launcher enter app
rails c
auto_tag_words = WatchedWord.where(replacement: "fruit").pluck(:word)
4 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.