We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29635
    • 361 Posts
    The Man Can! Reply #1, 20 years ago
    Hello all.
    I’m having a bit of trouble figuring out out the tagMode parameter, using Ditto 1.0.2.

    • onlyTags seems to return everything, regardless of tags.
    • onlyAllTags seems to return only the docs that have all the tags, and only the tags listed in the &tags parameter. (ie. tags=`tag1,tag2,`
    • removeTags and removeAllTags, I can’t get either to return anything.
    If these have been detailed anywhere, could somebody point me in that direction? If not, does anybody have a better idea of what these tags are doing?

    It seems to me that there should be a mode where if &tags=`tag1,tag2,`, it would return all documents that have tag1 and tag2, but also return documents that have tag1, tag2, and tag4 or any other tags.
    Thanks for any help. -Brett

    I’m using 0.9.5 beta 2. Beta 3 seems to destroy all tagging support (same Ditto 1.0.2, so I think it’s something else), though it could just be me.
      Need MODx Ecommerce? Try FoxyCart!
      • 18397
      • 3,250 Posts
      MARKSVIRTUALDESK Reply #2, 20 years ago
      onlyTags should return documents that have any of the specified tags
      onlyAllTags should only return documents that have all of the specified tags
      removeTags should remove documents from the output that have any of the specified tags
      removeAllTags should remove documents from the output that have all of the specified tags
        • 29635
        • 361 Posts
        The Man Can! Reply #3, 20 years ago
        Thanks Mark. Greatly appreciated.
        You said all of those "should" behave like that. Has that behavior been confirmed? I haven’t had a chance to try it with 0.9.2.1, but it definitely does not seem to be working with 0.9.5 beta 2 (as I mentioned above).

        Thoughts? onlyAllTags works, but not as you described. Anybody out there tried tagging with 0.9.5 beta 2 (or beta 3)?

        Thanks!
        Brett
          Need MODx Ecommerce? Try FoxyCart!
          • 18397
          • 3,250 Posts
          MARKSVIRTUALDESK Reply #4, 20 years ago
          I’ve been testing in 0.9.2.1 as the 0.9.5 codebase has been changing considerably over the last few weeks.
            • 29635
            • 361 Posts
            The Man Can! Reply #5, 20 years ago
            Mark, thanks for your help. Sorry to be dense, but I just can’t get it to work as I think it should, and I want to make sure I’m understanding. So...

            If I have a doc A that has tags="ring,diamond,gemstone," and doc B with tags="ring, diamond,", and I call Ditto with mode=`onlyAllTags` and tags=`ring,diamond,` I should get both doc A and doc B returned?

            As it is, in 0.9.5 beta 2, I’d only get doc B returned. If I set mode=`onlyTags`, I’d get back every doc under the startID regardless of tag.

            Is that wrong, or am I missing the boat? Thanks for your patience and help.

            Additional Odd Behavior:
            I have 10 documents with tags=`diamond,pendant,` and 2 docs that have tags=`diamond,pendant,3stone`
            If I set Ditto &tags=`diamond,pendant,3stone`, it only returns the 10 docs with the 2 tags, and not the 2 docs with the proper tags. If I set those 2 docs to just tags=`diamond,3stone` and change the Ditto call to those two tags, the two docs show up fine.

            That’s just bizarre. I’ve tried everything I can think of but the more I test, the more crazy results I end up with.

            Update: I tried using Ditto 1.1 beta 1 and had the same results, so it’s either a bug in 0.9.5 (beta 2) or a bug in Ditto. Or I’m just being really slow. Thanks for any help.
              Need MODx Ecommerce? Try FoxyCart!
              • 25059
              • 47 Posts
              Hu^^ i made a search to foucnd a topic like this with no results. Maybe I used wrong words :p

              Anyway, I’m working on somthing similar.
              The comportement of onlyAllTags is that it returns the documents with exactly the same tags. That’s why it returns only the docB in your previous exemple.
              I’d try to use onlyTags but it returns all documents with one of the tags. No interest for what I want to do...

              Just a copy/paste of my pevious post in Ditto beta:
              Quote from: RiderCrazy at Oct 18, 2006, 07:40 AM

              Hi there...
              Great improvement of Ditto wink

              Something I would like to do. I’ve tried on previous Ditto’s version since I installed this one. My problem is with filters.
              With tagMode, we can control the comportement. But there’s one that is not implemented.
              I use multiple tags (2 and more) with Tv.
              When you use "onlyTags", it selects pages with one of them.
              When you use "onlyAllTags", it selects pages only if you gave it all the tags of the Tv.

              What I want to do, is to select pages with all the tags that I put in my url.

              An exemple:
              Tv Page1: test1,test2,test3
              Tv Page2: test2,test3,test4


              • Url: &tags=test1,test2 -> result: Page1 (actually: onlyTags -> Page1 AND Page2; onlyAllTags -> none)
              • Url: &tags=test2,test3 -> result: Page1 AND Page2 (actually: onlyTags -> Page1 AND Page2; onlyAllTags -> none)
              • Url: &tags=test3,test4 -> result: Page2 (actually: onlyTags -> Page1 AND Page2; onlyAllTags -> none)
              • Url: &tags=test1,test4 -> result: none (actually: onlyTags -> Page1 AND Page2; onlyAllTags -> none)
              • Url: &tags=test1,test2,test3 -> result: Page1 (actually: onlyTags -> Page1 AND Page2; onlyAllTags -> Page1)

              I’ve tried to hack filters, but nothing like this for the moment :/

              (sorry for my english :p)

                :: RiderCrazy.Com :: Server@Home - [WIP] En cours de transition vers MODx
                • 29635
                • 361 Posts
                Quote from: RiderCrazy at Oct 18, 2006, 09:09 AM

                Hu^^ i made a search to foucnd a topic like this with no results. Maybe I used wrong words :p
                Yeah, the forum search is pretty horrible. Even if you search for "quirkiness", which is in the subject of this thread, it returns nothing. Google site:modxcms.com works better.

                Quote from: RiderCrazy at Oct 18, 2006, 09:09 AM

                The comportement of onlyAllTags is that it returns the documents with exactly the same tags. That’s why it returns only the docB in your previous exemple.
                I’d try to use onlyTags but it returns all documents with one of the tags.
                I’ve tried that, but onlyTags returns every single document regardless of tags (as far as I can tell). I’d bet that if you put &tags=test1 (per your example), it’d actually return Page1 and Page2 (with onlyTags), and nothing with onlyAllTags.

                I think I’m having the exact same issue that Zap just fixed here. That might work for your problem with the filter, but doesn’t seem to work for tags (even though as far as I can tell it should).

                Are you sure onlyAllTags only returns when the tags are exact (no more, no less)? I thought it was when the doc had at least all the tags being called by Ditto. That’s how I read Mark’s comment above. Mark, can you confirm? So... with onlyAllTags...

                &tags=test1,test2 should return Page1, right? That’s definitely not working.

                With onlyTags...
                &tags=test1 should return Page1 and not Page2.
                And that’s not working for me either. Can you test that on your end and see if onlyTags works for you?

                Thanks.
                  Need MODx Ecommerce? Try FoxyCart!
                  • 25059
                  • 47 Posts
                  Quote from: The at Oct 18, 2006, 12:41 PM
                  I’ve tried that, but onlyTags returns every single document regardless of tags (as far as I can tell). I’d bet that if you put &tags=test1 (per your example), it’d actually return Page1 and Page2 (with onlyTags), and nothing with onlyAllTags.
                  Nothing for onlyAllTags but it returns Page1 only with onlyTags... for me :p

                  Quote from: The at Oct 18, 2006, 12:41 PM
                  I think I’m having the exact same issue that Zap just fixed here. That might work for your problem with the filter, but doesn’t seem to work for tags (even though as far as I can tell it should).
                  I don’t use filters but tags... but I will test this solution.

                  Quote from: The at Oct 18, 2006, 12:41 PM
                  Are you sure onlyAllTags only returns when the tags are exact (no more, no less)? I thought it was when the doc had at least all the tags being called by Ditto. That’s how I read Mark’s comment above. Mark, can you confirm? So... with onlyAllTags...
                  After another test, it works like Mark said wink

                  Quote from: The at Oct 18, 2006, 12:41 PM

                  &tags=test1,test2 should return Page1, right? That’s definitely not working.
                  True

                  Quote from: The at Oct 18, 2006, 12:41 PM
                  With onlyTags...
                  &tags=test1 should return Page1 and not Page2.
                  And that’s not working for me either. Can you test that on your end and see if onlyTags works for you?
                  This one works for me... :/
                    :: RiderCrazy.Com :: Server@Home - [WIP] En cours de transition vers MODx
                    • 25059
                    • 47 Posts
                    Up ! :p

                    Mark, can you explain how does the tagFilter function work ?
                    I’m working on it and I don’t understand how you can select document by those "if". I’m going crazy with that.

                    	function tagFilter ($value) {
                    		$this->filterValue = $this->tags;
                    		$documentTags = explode($this->tagDelimiter, $this->filterValue);
                    		$filterTags = explode($this->tagDelimiter, $this->combineTags($this->tagData, $value));
                    		$compare = array_intersect($filterTags, $documentTags);
                    		$commonTags = count($compare);
                    		$totalTags = count($filterTags);
                    		$unset = 1;
                    		switch ($this->filtertype) {
                    			case "onlyAllTags" :
                    			case 7 :
                    				if ($commonTags != $totalTags)
                    					$unset = 0;
                    				break;
                    			case "removeAllTags" :
                    			case 8 :
                    				if ($commonTags == $totalTags)
                    					$unset = 0;
                    				break;
                    			case "onlyTags" :
                    			case 9 :
                    				if ($commonTags > $totalTags || $commonTags == 0)
                    					$unset = 0;
                    				break;
                    			case "removeTags" :
                    			case 10 :
                    				if ($commonTags <= $totalTags && $commonTags != 0)
                    					$unset = 0;
                    				break;
                    			}
                    			return $unset;
                    	}
                      :: RiderCrazy.Com :: Server@Home - [WIP] En cours de transition vers MODx
                      • 17544
                      • 86 Posts
                      Can you guys post the complete snippet code starting from [[Ditto

                      I can’t make the tag works. I am even not sure what to assign to &tagData=, is it just the TV name? or I need to prefix it with ’tv’? or I need to enclosed it within [* and *] ?

                      huh Help Help!