1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Thoughts on retroactively adding thread tags

Discussion in 'Forum Management' started by 0ptima, Jul 19, 2015.

  1. 0ptima

    0ptima Well-Known Member

    Now that XF supports thread tags natively, I was thinking about retroactively adding thread tags to all existing threads on my forum. The thread tags would be based on the thread title and would be normalized and would not include words from a stop list. Every thread would be tagged in a one shot automated process.

    Do you think the end result would be something that would be useful and of decent quality? Or would this just make a mess of the tags?
    Fred. likes this.
  2. Mouth

    Mouth Well-Known Member

  3. 0ptima

    0ptima Well-Known Member

    Very interesting. I dont have Elastic search installed, but I plan to and will re-visit this topic at a later date.
  4. Mike

    Mike XenForo Developer Staff Member

    I don't think a wholly programmatic approach will work too well, at least if only using a basic approach. If you took this thread, I presume you'd end up with tags:
    • thoughts
    • retroactively
    • adding
    • thread
    • tags
    I don't think those tags are necessarily helpful. Maybe "tags" is correct, but you may want "thread tags" instead; the rest seem like noise.
    0ptima likes this.
  5. Fred.

    Fred. Well-Known Member

    I don't like automatic tagging because I don't think it can work good.

    But how about adding a tag to all threads in a certain forum? I was thinking about this.
    It would be useful on one of my forums.

    Can we use a SQL query for this?
  6. 0ptima

    0ptima Well-Known Member

    No, as there is serialized data

    The following code worked for me when I tested it on a single thread. You could expand it to loop through all the threads in a forum. Maybe add it to a XF cron and only update threads with no tags?

              $xfDb XenForo_Application::getDb();
    $forumid 10;
    $threadid 1234;
    $forum $xfDb->fetchRow('
                SELECT *
                FROM xf_forum
                WHERE node_id = ?
    $thread $xfDb->fetchRow('
                SELECT *
                FROM xf_thread
                WHERE thread_id = ?

    $tags "test, tags";

    $tagModel XenForo_Model::create('XenForo_Model_Tag');
    $tagger $tagModel->getTagger('thread');

    $errors $tagger->getErrors();
                if (

    $cache $tagger->save();
    Fred. likes this.
  7. Fred.

    Fred. Well-Known Member

    Thanks optima (y)
    Not sure if I'm able to figure that out but I'll give it a try. :)
  8. Alfa1

    Alfa1 Well-Known Member

    If you start adding the same tags to all threads in a large node then these tags will become your most popular tags and this is what will always be displayed in your tag cloud. If you are looking for a SEO enhancement then take a closer look.
  9. 0ptima

    0ptima Well-Known Member

  10. jauburn

    jauburn Well-Known Member

    Are tags really worth all that effort? Jeez, I'd need to see some quantifiable, verifiable payoff to sink all that time into tagging existing threads.

Share This Page