Thread Tagging Improvements

Thread Tagging Improvements 1.0.7 Patch Level 6

No permission to download
mazzly updated Thread Tagging Improvements with a new update entry:

Fix for ambiguous column name in query

There was a bug where we queried the thread title with an ambiguous column name, which works fine as long as no other add-on does a JOIN with another table that has a similarly named column. (e.g. XFA Tournaments addon)

TL;DR; Fixed our add-on to explicitly query for xf_thread.title instead of title so SQL knows exactly which one we want.

Read the rest of this update entry...
 
Seems to be in conflict with XFA Tournaments addon?
Got this error in server log today. I haven't tried to install the tag addon since the initial error posted above, but seems like it is trying to run the complete job.

Server error log
  • XF\Db\Exception: Job MaZ\PotentialTagHelper:RebuildPotentialThreadTags: MySQL statement prepare error [1052]: Column 'title' in where clause is ambiguous
  • src/XF/Db/AbstractStatement.php:230
  • Generated by: Unknown account
  • May 1, 2023 at 5:20 PM

Stack trace​

SELECT xf_thread.thread_id, xf_thread.title
FROM xf_thread
LEFT JOIN xf_xfa_tourn_tournament AS xf_xfa_tourn_tournament_Tournament_1 ON (xf_xfa_tourn_tournament_Tournament_1.discussion_thread_id = xf_thread.thread_id)
WHERE (xf_thread.thread_id NOT IN (136)) AND (LOWER(title) LIKE '%mythic games%') AND (xf_thread.discussion_state = 'visible') AND (xf_thread.discussion_type != 'redirect')


------------

#0 src/XF/Db/Mysqli/Statement.php(198): XF\Db\AbstractStatement->getException('MySQL statement...', 1052, '23000')
#1 src/XF/Db/Mysqli/Statement.php(41): XF\Db\Mysqli\Statement->getException('MySQL statement...', 1052, '23000')
#2 src/XF/Db/Mysqli/Statement.php(56): XF\Db\Mysqli\Statement->prepare()
#3 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute()
#4 src/XF/Mvc/Entity/Finder.php(1474): XF\Db\AbstractAdapter->query('
SELECT `xf_...')
#5 src/XF/Mvc/Entity/Finder.php(1489): XF\Mvc\Entity\Finder->fetchRaw(Array)
#6 src/addons/MaZ/PotentialTagHelper/Repository/PotentialTags.php(104): XF\Mvc\Entity\Finder->fetchColumns('thread_id', 'title')
#7 src/addons/MaZ/PotentialTagHelper/Repository/PotentialTags.php(79): MaZ\PotentialTagHelper\Repository\PotentialTags->collectThreadIdsForWord('mythic games', Array)
#8 src/addons/MaZ/PotentialTagHelper/Job/RebuildPotentialThreadTags.php(39): MaZ\PotentialTagHelper\Repository\PotentialTags->collectThreadIdsForTag(Object(MaZ\PotentialTagHelper\XF\Entity\Tag), Array)
#9 src/XF/Job/AbstractRebuildJob.php(42): MaZ\PotentialTagHelper\Job\RebuildPotentialThreadTags->rebuildById(106)
#10 src/XF/Job/Manager.php(260): XF\Job\AbstractRebuildJob->run(8)
#11 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 8)
#12 src/XF/Job/Manager.php(86): XF\Job\Manager->runJobEntry(Array, 8)
#13 job.php(43): XF\Job\Manager->runQueue(false, 8)
#14 {main}

Request state​

array(4) {
["url"] => string(8) "/job.php"
["referrer"] => string(73) "https://www.boardgamedungeon.net/threads/mythic-games-latest-blunder.136/"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
Fix should be in latest release :) 👍
 
Do you have the full trace? That one is quite generic place where the error happened so would be good to know the path that triggered it 😊👌
  • XF\Db\Exception: MySQL query error [1406]: Data too long for column 'execute_data' at row 1
  • src/XF/Db/AbstractStatement.php:230
UPDATE xf_job SET execute_data = ?, trigger_date = ?, last_run_date = ? WHERE job_id = ?
------------

#0 src/XF/Db/Mysqli/Statement.php(198): XF\Db\AbstractStatement->getException('MySQL query err...', 1406, '22001')
#1 src/XF/Db/Mysqli/Statement.php(79): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1406, '22001')
#2 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(324): XF\Db\AbstractAdapter->query('UPDATE `xf_job...', Array)
#4 src/XF/Job/Manager.php(225): XF\Db\AbstractAdapter->update('xf_job', Array, 'job_id = ?', 213346)
#5 src/XF/Job/Manager.php(118): XF\Job\Manager->runJobEntry(Array, 8)
#6 src/XF/Admin/Controller/Tools.php(122): XF\Job\Manager->runByIds(Array, 8)
#7 src/XF/Mvc/Dispatcher.php(352): XF\Admin\Controller\Tools->actionRunJob(Object(XF\Mvc\ParameterBag))
#8 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XF:Tools', 'RunJob', Object(XF\Mvc\RouteMatch), Object(Truonglv\ImageOptimizer\XF\Admin\Controller\Tools), NULL)
#9 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(Truonglv\ImageOptimizer\XF\Admin\Controller\Tools), NULL)
#10 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#11 src/XF/App.php(2483): XF\Mvc\Dispatcher->run()
#12 src/XF.php(524): XF\App->run()
#13 admin.php(13): XF::runApp('XF\\Admin\\App')
#14 {main}

array(4) {
["url"] => string(24) "/admin.php?tools/run-job"
["referrer"] => string(50) "https://forum.x.com/admin.php?tools/run-job"
["_GET"] => array(1) {
["tools/run-job"] => string(0) ""
}
["_POST"] => array(3) {
["_xfRedirect"] => string(87) "https://forum.x.com/admin.php?add-ons/install-from-archive-complete&batch_id=142"
["_xfToken"] => string(8) "********"
["only_ids"] => string(13) "213346,213347"
}
}
 
  • XF\Db\Exception: MySQL query error [1406]: Data too long for column 'execute_data' at row 1
  • src/XF/Db/AbstractStatement.php:230
UPDATE xf_job SET execute_data = ?, trigger_date = ?, last_run_date = ? WHERE job_id = ?
------------

#0 src/XF/Db/Mysqli/Statement.php(198): XF\Db\AbstractStatement->getException('MySQL query err...', 1406, '22001')
#1 src/XF/Db/Mysqli/Statement.php(79): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1406, '22001')
#2 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(324): XF\Db\AbstractAdapter->query('UPDATE `xf_job...', Array)
#4 src/XF/Job/Manager.php(225): XF\Db\AbstractAdapter->update('xf_job', Array, 'job_id = ?', 213346)
#5 src/XF/Job/Manager.php(118): XF\Job\Manager->runJobEntry(Array, 8)
#6 src/XF/Admin/Controller/Tools.php(122): XF\Job\Manager->runByIds(Array, 8)
#7 src/XF/Mvc/Dispatcher.php(352): XF\Admin\Controller\Tools->actionRunJob(Object(XF\Mvc\ParameterBag))
#8 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XF:Tools', 'RunJob', Object(XF\Mvc\RouteMatch), Object(Truonglv\ImageOptimizer\XF\Admin\Controller\Tools), NULL)
#9 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(Truonglv\ImageOptimizer\XF\Admin\Controller\Tools), NULL)
#10 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#11 src/XF/App.php(2483): XF\Mvc\Dispatcher->run()
#12 src/XF.php(524): XF\App->run()
#13 admin.php(13): XF::runApp('XF\\Admin\\App')
#14 {main}

array(4) {
["url"] => string(24) "/admin.php?tools/run-job"
["referrer"] => string(50) "https://forum.x.com/admin.php?tools/run-job"
["_GET"] => array(1) {
["tools/run-job"] => string(0) ""
}
["_POST"] => array(3) {
["_xfRedirect"] => string(87) "https://forum.x.com/admin.php?add-ons/install-from-archive-complete&batch_id=142"
["_xfToken"] => string(8) "********"
["only_ids"] => string(13) "213346,213347"
}
}
Are you on the latest version? I can't find any reference in our code to only_ids and it makes me think it might be from an older version? 🤔
Also, does this happen often, or only once?
I'm not sure, but I guess their add-on does similar template modifications to the admin UI, which might make this and/or that add-on not work correctly...

Both add-ons add synonyms to tags, their add-on does it by creating a new tag, which references the "correct" tag, while our add-on adds a list of synonym tags to the tag object...

Is there some reason you would want both? 🤔

If you are mainly interested in the "potential tags" feature, maybe you could test installing it on a development/staging environment with a recent data backup to see what potential tags you could add to the production site. :) That way you don't risk breaking production but could easier identify if you have missed some common tags :)

Do you think there's anything I can uninstall / delete / rebuild / etc. to fix this? @Frode789 does yours do this?

View attachment 285641
This one is quite interesting... For some reason when XF core functionality is building the URL it doesn't seem to add the protocol... I'll dig a bit deeper here..
 
Are you on the latest version? I can't find any reference in our code to only_ids and it makes me think it might be from an older version? 🤔
Also, does this happen often, or only once?

I'm not sure, but I guess their add-on does similar template modifications to the admin UI, which might make this and/or that add-on not work correctly...

Both add-ons add synonyms to tags, their add-on does it by creating a new tag, which references the "correct" tag, while our add-on adds a list of synonym tags to the tag object...

Is there some reason you would want both? 🤔

If you are mainly interested in the "potential tags" feature, maybe you could test installing it on a development/staging environment with a recent data backup to see what potential tags you could add to the production site. :) That way you don't risk breaking production but could easier identify if you have missed some common tags :)


This one is quite interesting... For some reason when XF core functionality is building the URL it doesn't seem to add the protocol... I'll dig a bit deeper here..
its the latest when trying to install. I've never used this add-on before.
 
its the latest when trying to install. I've never used this add-on before.
I guess the add-on was installed, but the post-install job is failing due to trying to insert too much temporary data in a column (which allows up to 16Mb of data)...

Is it a large forum? do you have stats on the amount of threads?

If it is a large forum (and add-on is installed), could you try lowering the "Potential tags max word count" to 1, and then go to ACP home page and try rerunning/finishing the jobs that failed (if it shows such an option).

1683445993145.webp

It might be that the default value of counting that many words is not good for larger forums, and I need to look into some other way to store that temporary data while building the potential tag words... If my hunch is correct, changing that value to 1 should at least help with not getting too many potential tag combinations during that job...
 
I guess the add-on was installed, but the post-install job is failing due to trying to insert too much temporary data in a column (which allows up to 16Mb of data)...

Is it a large forum? do you have stats on the amount of threads?

If it is a large forum (and add-on is installed), could you try lowering the "Potential tags max word count" to 1, and then go to ACP home page and try rerunning/finishing the jobs that failed (if it shows such an option).

View attachment 285689

It might be that the default value of counting that many words is not good for larger forums, and I need to look into some other way to store that temporary data while building the potential tag words... If my hunch is correct, changing that value to 1 should at least help with not getting too many potential tag combinations during that job...
Define large? We have millions of posts. Will check your suggestions later.

Ty
 
After installing, i cant do this

/admin.php?tags/

checkbox a tag, select delete.

=> page not found;
there is a type in your form!

After deinstalling, i can do this again.

I am too lazy to search now for the typo, you may want to try it for yourself.
 
After installing, i cant do this

/admin.php?tags/

checkbox a tag, select delete.

=> page not found;
there is a type in your form!

After deinstalling, i can do this again.

I am too lazy to search now for the typo, you may want to try it for yourself.
"checkbox a tag" sounds like some functionality from another add-on..

Was the tag deleted after you returned to the tags page?

You could try unchecking this option:
1683631024254.png

See if that helps :) 👍
 
This addon was breaking tagging all across my site. Even though I had it in the DISABLED state. Once I "uninstalled" this addon, tags started working perfectly fine.

I'm running XF 2.2.12, and 1.0.7 patch lvl 4 of this addon.

The errors it specifically gave:
XF\Db\DuplicateKeyException: MySQL query error [1062]: Duplicate entry '821c7692103a0323c1a349ee5531f209' for key 'xf_mg_media_item.media_hash'
src/XF/Db/AbstractStatement.php:230
XF\Db\Exception: MySQL query error [1364]: Field 'pth_is_loner' doesn't have a default value
src/XF/Db/AbstractStatement.php:230
Once fully uninstalled, not just disabled, the errors instantly fixed.
 
This addon was breaking tagging all across my site. Even though I had it in the DISABLED state. Once I "uninstalled" this addon, tags started working perfectly fine.

I'm running XF 2.2.12, and 1.0.7 patch lvl 4 of this addon.

The errors it specifically gave:


Once fully uninstalled, not just disabled, the errors instantly fixed.
Sorry, I've totally missed this message. Yes there seems to be missing a default value in the installation there so I'll need to release a fix version that sets it correct. I don't think the Duplicate entry-error is related to this add-on though :)

Anyone currently using this without it causing errors?
We're using it fine on our forum, but also our forum is not running XF 2.2.12 yet..

Does this contain a page for the tag where it lists threads that is holding that tag? Also in the same page, an way to hold a tag description that you can edit(Tag wiki)? Sort of like https://xenforo.com/community/resources/tag-essentials-with-ai-auto-tagging-and-xfrm-support.6759/

That's something I be willing to pay/sponsor!
That "page" is a default Xenforo functionality for tags actually, if you go to yourforum.com/tags/tagname it will show the threads that are tagged with tagname (needs to exist).

The option for adding a short description like a "wiki" is ofc possible, but need to see how it should be implemented, i.e. if it needs full editor capabilities, or if simple text is enough, also should there be limits to the text length etc etc?
 
That "page" is a default Xenforo functionality for tags actually, if you go to yourforum.com/tags/tagname it will show the threads that are tagged with tagname (needs to exist).
Never noticed it lol.

The option for adding a short description like a "wiki" is ofc possible, but need to see how it should be implemented, i.e. if it needs full editor capabilities, or if simple text is enough, also should there be limits to the text length etc etc?
Full editor capabilities would be nice to be able to format wiki just like in a thread/post and be able to insert embedded images from gallery or maybe insert attachments, not sure if that would be feasible or just easier to have embedded images for gallery would be enough. Would also be nice to show the tag category in the wiki page somewhere.

No, shouldn't need to limit it.

Here are some images:
tag_wiki_page.webptag_wiki_page_editor.webp

Thanks!
 
Anyone currently using this without it causing errors?
@mazzly I'm still having page not found issues. I'm on Xenforo v2.2.7 Patch 1.

------------------

1. When I change the "Ordered by" dropdown or enter a search term, and then click on the "Go" button.
1696315503583.png

I get the following:
1696315579384.png

It looks like the URL is doubling up in the address bar:
Code:
https://myforum.com/admin.php?//myforum.com/admin.php?tags/potential&order=alphabetical&page=1

------------------

2. On the Tags page, when I change the "Ordered by" dropdown or enter a search term, and then click on the "Go" button.
1696315886028.png

I get the following:
1696315579384.png

Again the URL is doubled up in the address bar like this:
Code:
https://myforum.com/admin.php?//myforum.com/admin.php?tags/&order=use_count

------------------

3. When I click on the "(Excluding 1 ignored)" link:
1696316218071.png

I get the following:
1696316293992.png

Once again the URL is doubled up in the address bar like this:
Code:
https://myforum.com/admin.php?//myforum.com/admin.php?tags/mytag.74/manage-potential-threads&_xfRedirect=https%3A%2F%2Fmyforum.com%2Fadmin.php%3Ftags%2F%26page%3D2&_xfRequestUri=%2Fadmin.php%3Ftags%2F%26page%3D2&_xfWithData=1&_xfToken=1696316179%2Ca3c10e616019d9640c28a2492f9a00fb&_xfResponseType=json&ignored=1
 

Attachments

  • 1696315561757.webp
    1696315561757.webp
    4.2 KB · Views: 3
Top Bottom