We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34950
    • 31 Posts
    I am using TVs as tags on the site. I have also set up when a tag is clicked it redirects to SimpleSearch page with the contents of that tag. However, the search also lists the results found within the content of the post, and not just the tags. Is there a way to limit search results to show only tags?
      • 4172
      • 5,888 Posts
      you don't need SimpleSearch for that.
      You can use getResources or pdoRsources with tvfilters to get the results listed.

      You could also look into tagger for a better tagging-system, than using TVs for tags
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 34950
        • 31 Posts
        Thanks Bruno, I'm trying to set it up with getResources... I have a separate page with results that has code like this:

        <p>[[!getPage? &elementClass=`modSnippet` &element=`getResources` &limit=`10` &pageVarKey=`page` &includeTVs=`1` &processTVs=`1` &includeContent=`0` &tpl=`blogPost` &showHidden=`1`  &parents=`5,19` &tvFilters=`tags==%[[+search]]%`</p>
        
        <div class="pagination pagination-mini">
        <ul>
        	<li>[[!+page.nav]]</li>
        </ul>
        </div>


        and I'm not sure how to give it the parameter for the actual tag... if I hardcode the tag it works. I would pass the tag from:
        [[+tv.tags:notempty=`<ul class="tags">[[!tolinks? &items=`[[+tv.tags]]` &tagKeyVar=`` &tagKey=`` &tagRequestParam=`search` &target=`101` &outputDelim=``]]</ul>`]]
          • 34950
          • 31 Posts
          I was able to resolve this after many solutions that seemed like they should have worked didn't work for me (getResourceTag...). In the end I wrote a small snippet that does something like this:

          <?php
          $parametersArray = array();
          
          foreach ($_GET as $key => $value) {
          	if($key=='search') return $value;
          }
          
          return '';


          And I am sending the search parameter like before. I am receiving it like this:

          &tvFilters=`tags==%[[!GetSearchParameter]]%`


          but MODX team... this should not have been this complicated. It should have worked out of the box without so many confusing options and misleading configurations. I haven't touched MODX for a couple of years now, and now I have to relearn all the syntax to get something this simple running?
            • 22840
            • 1,572 Posts
            but MODX team... this should not have been this complicated. It should have worked out of the box without so many confusing options and misleading configurations. I haven't touched MODX for a couple of years now, and now I have to relearn all the syntax to get something this simple running?

            MODX does not come wit a built in search capability, as it doesn't come with anything else which is what makes it so flexable, nothing works out of the box as there is no out of the box with MODX, its a platform to build upon.
              • 4172
              • 5,888 Posts
              you would use a snippet like getReqParam, no need to create your own, or fastField-tags would also work.

              Many ways to get things done.
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!