Quick bug I've spotted in 2.2.2. If I have some content, and I go through and tag several pages with the same tag, in the cmsTags table, I have a record inserted for each page I tagged, with the SAME tag in. So if I tag 6 pages as "public sector", then there are six rows in the tags table, all saying "public sector" as their tag. However, when you look in the tagsRelationship table, all the pages are correctly tagged against the FIRST instance of the tag in the tags table. This means that for every page that you tag, there will be a redundant entry in the tags table for EVERY tag that you enter against a page.
This has been observed on 4.5.2. Haven't had a chance to test it on anything newer yet!
I've tracked down the issue (I think) the AutoTags.ascx file has the tag group hard coded to "GrailTechTags". You can change the tags in the setup/config now, and if you set it to anything other than the default value, the check to see if the tag already exists always comes up empty, so duplicate tags are inserted.
If you update the ascx file to use the config value, it should work as expected. As a temporary workaround you can use the hard coded tag group. Looking at the source for Umbraco, AddTagToNode creates the tag if it doesn't exist anyway, so you could probably do away with the code to add it in your code. I'll have a play with this properly in the morning and see If I can find out for definite what's occuring!
I seem to be a bit confused. I've recently updated my website and used this version pulled directly from the repo, so for all intents and purposes the same version you're running. I've just checked the database and there aren't any duplicate entries in the cmsTags table. I'm using the tag group of 'default' and it all seems to be behaving. The only difference that immediately jumps to mind is I'm running umbraco v4.7.1...
Also, where you say AutoTags.ascx has GrailTechTags hardcoded, which line are you viewing this on as I can't see it in the usercontrol? The codebehind uses this as a default value if there isn't one set in the config file, but thats all I can see?
I think I was looking at the wrong ascx file inthe source, is the latest version the one in the 2.1 tag? I was originally looking in the trunk folder, sorry!
It looks like it's pulling the group through OK in the .ascx file, but it's still inserting duplicate items. Just testing with 4.7 now, then going to do some debugging and see if its the 4.5.2 tag code that's the issue! Will post as soon as I'm done.
It definitely looks like it's 4.5.2 where it has issues. I've noticed an additional issue in 4.5.2, where if you save a page with no tags in it at all, a blank tag is saved to the tags table, and the page is tagged to it.
I can't see anything wrong with the code though. Your ascx file is calling pretty much the same code as the built in tags code (which tags stuff fine, just suffers from the usual UI bugs that have plagued it for ages). It's almost like it's calling the add either twice at the same time, or there's some code somewhere that's adding the tags without checking if it exists first, although I can't find any code that does that anywhere. Very odd.
The code uses the built in tagging code directly as I thought this would be the best mechanism to use as it already exists. So does the standard tag control in 4.5.2 add a blank record if there are no tags selected or just this package? I do seem to remember older versions of the tag control would throw in a blank entry most times you saved, certainly on v4.0.2 at least...
If its this control, I can see exactly why a blank entry is being added, and I'll be able to get a fix for that up later. However, the duplicate entry bug is an annoyance. Although this package has moved to be compatible with 4.7+, and I'd rather not reinvent the wheel by creating a new data layer to allow for better tag management, if you're unable/not going to upgrade to 4.7 I might be able to sort something out over the next day or so?
The built in tagging code doesn't insert the blank tag, I've spotted where it does that in the AutoTags ascx file as well, just needs a check round it to see if the tags are empty. The blank tag issue was from 4.0.2 I think, it got fixed in 4.1 according to the changelogs.
The duplicate tagging is very odd though, you're calling the same code to add tags as the built in tag control, which should be checking for duplicate entries. The duplicate entries have the same tag name and group name, and have the same case, and there's no extra padding in the field either.
As a temporary fix, I've added a trigger to the tagsRelationship table to delete ununsed tags after a record is added there.
I can't seem to find 4.5 on the HG repository at the moment, I was going to download that and run it in debug mode to see if I could work out what was going on. If you need any help tracking the issue down let me know. I'll have a play with this some more later on today and see if I can find out anything more information!
:)
I wouldn't go to the effort of writing an extra datalayer! Hopefully I can work out what the issue is and it can be solved by less drastic means :P
I found out why it was having the issue, it was because there was a tag with an id of 0 in the tags table, which meant that Umbraco's check to see if a tag exists (which adds the tag of the id is 0) was always returning 0, so it added the tag loads of times.
It's still adding the empty tag and adding content to to that tag when no tags are present though.
Tags being inserted multiple times.......
Quick bug I've spotted in 2.2.2. If I have some content, and I go through and tag several pages with the same tag, in the cmsTags table, I have a record inserted for each page I tagged, with the SAME tag in. So if I tag 6 pages as "public sector", then there are six rows in the tags table, all saying "public sector" as their tag. However, when you look in the tagsRelationship table, all the pages are correctly tagged against the FIRST instance of the tag in the tags table. This means that for every page that you tag, there will be a redundant entry in the tags table for EVERY tag that you enter against a page.
This has been observed on 4.5.2. Haven't had a chance to test it on anything newer yet!
I've tracked down the issue (I think) the AutoTags.ascx file has the tag group hard coded to "GrailTechTags". You can change the tags in the setup/config now, and if you set it to anything other than the default value, the check to see if the tag already exists always comes up empty, so duplicate tags are inserted.
If you update the ascx file to use the config value, it should work as expected. As a temporary workaround you can use the hard coded tag group. Looking at the source for Umbraco, AddTagToNode creates the tag if it doesn't exist anyway, so you could probably do away with the code to add it in your code. I'll have a play with this properly in the morning and see If I can find out for definite what's occuring!
Hi Tim,
I seem to be a bit confused. I've recently updated my website and used this version pulled directly from the repo, so for all intents and purposes the same version you're running. I've just checked the database and there aren't any duplicate entries in the cmsTags table. I'm using the tag group of 'default' and it all seems to be behaving. The only difference that immediately jumps to mind is I'm running umbraco v4.7.1...
Also, where you say AutoTags.ascx has GrailTechTags hardcoded, which line are you viewing this on as I can't see it in the usercontrol? The codebehind uses this as a default value if there isn't one set in the config file, but thats all I can see?
Hiya,
I think I was looking at the wrong ascx file inthe source, is the latest version the one in the 2.1 tag? I was originally looking in the trunk folder, sorry!
It looks like it's pulling the group through OK in the .ascx file, but it's still inserting duplicate items. Just testing with 4.7 now, then going to do some debugging and see if its the 4.5.2 tag code that's the issue! Will post as soon as I'm done.
:)
It definitely looks like it's 4.5.2 where it has issues. I've noticed an additional issue in 4.5.2, where if you save a page with no tags in it at all, a blank tag is saved to the tags table, and the page is tagged to it.
I can't see anything wrong with the code though. Your ascx file is calling pretty much the same code as the built in tags code (which tags stuff fine, just suffers from the usual UI bugs that have plagued it for ages). It's almost like it's calling the add either twice at the same time, or there's some code somewhere that's adding the tags without checking if it exists first, although I can't find any code that does that anywhere. Very odd.
:S
The code uses the built in tagging code directly as I thought this would be the best mechanism to use as it already exists. So does the standard tag control in 4.5.2 add a blank record if there are no tags selected or just this package? I do seem to remember older versions of the tag control would throw in a blank entry most times you saved, certainly on v4.0.2 at least...
If its this control, I can see exactly why a blank entry is being added, and I'll be able to get a fix for that up later. However, the duplicate entry bug is an annoyance. Although this package has moved to be compatible with 4.7+, and I'd rather not reinvent the wheel by creating a new data layer to allow for better tag management, if you're unable/not going to upgrade to 4.7 I might be able to sort something out over the next day or so?
Hiya,
The built in tagging code doesn't insert the blank tag, I've spotted where it does that in the AutoTags ascx file as well, just needs a check round it to see if the tags are empty. The blank tag issue was from 4.0.2 I think, it got fixed in 4.1 according to the changelogs.
The duplicate tagging is very odd though, you're calling the same code to add tags as the built in tag control, which should be checking for duplicate entries. The duplicate entries have the same tag name and group name, and have the same case, and there's no extra padding in the field either.
As a temporary fix, I've added a trigger to the tagsRelationship table to delete ununsed tags after a record is added there.
I can't seem to find 4.5 on the HG repository at the moment, I was going to download that and run it in debug mode to see if I could work out what was going on. If you need any help tracking the issue down let me know. I'll have a play with this some more later on today and see if I can find out anything more information!
:)
I wouldn't go to the effort of writing an extra datalayer! Hopefully I can work out what the issue is and it can be solved by less drastic means :P
Where does the log4net logging code that you've got save it's log to? I'm going to add some extra logging and see if I can track this down.
Its normally located in c:\windows\temp\autoTags.log
Thanks! I'll let you know if I find anything :)
OK, it works fine now!
I found out why it was having the issue, it was because there was a tag with an id of 0 in the tags table, which meant that Umbraco's check to see if a tag exists (which adds the tag of the id is 0) was always returning 0, so it added the tag loads of times.
It's still adding the empty tag and adding content to to that tag when no tags are present though.
The blank tag issue affects 4.7 as well, just checked on a couple of sites.
Good find, is that a localised issue do you think though?
I'll get a fix for the empty tag released tonight and post here once its done. I really appreciate your help and patients with this package. Thanks :)
No worries, I went to download the source to make the change and submit a patch and saw you'd already beaten me to it!
:)
Thanks for getting back so fast, I really like this package (its a huge improvement on the built in tags control)!
Hi Tim,
So I've uploaded the fix in v2.2.3. Hope it serves you well
is working on a reply...