4 Replies Latest reply on May 16, 2012 6:40 PM by amyc

    Tags and Filters

      Lets say we have a large number of 'discussions' which are all flagged as questions and suppose we tag them all using a handful of tags. Is it possible to query up all the questions (discussions) within a particular tag and then filter them by either 'answered' or 'unanswered'?

        • Re: Tags and Filters

          hi Patrick,

           

          I'm going to assume that you're asking about this from the standpoint of the API. Assuming that, yes, you can get a list of all the answered / unanswered questions tagged with a specific tag:

          String tagName = "yourtag";
          ContentTag tag = getJiveContext().getTagManager().getTag(tagName);
          ArrayList<ContentTag> tagList = new ArrayList<ContentTag>();
          ThreadResultFilter filter = ThreadResultFilter.createDefaultThreadFilter();
          filter.addResolutionState(Question.State.open);
          tagList.add(tag);
          filter.setTags(tagList);
          community.getThreads(filter);
          

          That help?

           

          Cheers,

           

          AJ

            • Re: Tags and Filters

              Hi ajohnson1200

              is this code works for multiple tags?

              I have apply your code but weird result came out. I am hoping to get filter threads that are tagged with tagno1 and tagno2 if tagno2 is not null. But by default the threads is filter by tagno1 only. Is this the way to achieve this?

               

              String tagName = "tagno1";

              ContentTag tag = getJiveContext().getTagManager().getTag(tagName);

               

              ArrayList<ContentTag> tagList = new ArrayList<ContentTag>();

              ThreadResultFilter filter = ThreadResultFilter.createDefaultThreadFilter();

               

              tagList.add(tag);

               

              if(tagno2 != null){

                   tag = getJiveContext().getTagManager().getTag(tagno2 );

                   taglist.add(tag);

              }

               

              filter.setTags(tagList);

              community.getThreads(filter);

            • Re: Tags and Filters

              Thanks for the response, AJ. However, I was actually looking at this purely from a user perspective - not an API. I just need to know can I combine a tag with a filter without custom coding?

                • Re: Tags and Filters

                  Hi Patrick -- what you'd do is select the tag (or tag group if that's the case) and change the Type to Discussions (by de-selecting Blogs and Documents above the result list). The system will return a list of all Discussions with that tag and the UI will show you which are open and which are closed based upon the icon. I hope that helps. Give me a ring if you need more info.

                  1 person found this helpful