Exclude forums from search results

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • webgeek247
    Senior Member
    • Mar 2006
    • 291
    • 5.7.X

    Exclude forums from search results

    How can I exclude certain forums from "Today Posts"?
    Web Hosting Forum | Fastest Hosting | Backup Storage
  • Wayne Luke
    vBulletin Technical Support Lead
    • Aug 2000
    • 73981

    #2
    You can exclude channels by editing the search JSON used.

    exclude
    • array - list of node ids that need to be excluded from the results.
    • number - the id of the node that needs to be excluded from the results.
    Code:
    { "exclude":[1,2,3,4] } { "exclude":"24" }
    https://www.vbulletin.com/forum/arti...he-search-json
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API

    Comment

    • webgeek247
      Senior Member
      • Mar 2006
      • 291
      • 5.7.X

      #3
      The one I have there now for "Today's Posts" is this

      Code:
      search?searchJSON=%7B%22last%22%3A%7B%22from%22%3A%22lastDay%22%7D%2C%22view%22%3A%22topic%22%2C%22starter_only%22%3A+1%2C%22sort%22%3A%7B%22lastcontent%22%3A%22desc%22%7D%2C%22exclude_type%22%3A%5B%22vBForum_PrivateMessage%22%5D%7D
      Not sure how to add those to that?
      Web Hosting Forum | Fastest Hosting | Backup Storage

      Comment

      • webgeek247
        Senior Member
        • Mar 2006
        • 291
        • 5.7.X

        #4
        PS I'd like to exclude category which would exclude all channels within a category if that is possible?

        E.g

        - - - - Advertising Forums (Node ID: 35)
        - - - - - - Hosting Offers (Node ID: 20)
        - - - - - - - - Web Hosting Offers (Node ID: 31)
        - - - - - - - - Reseller Hosting Offers (Node ID: 22)
        - - - - - - - - VPS Hosting Offers (Node ID: 23)
        - - - - - - - - Dedicated Server Hosting Offers (Node ID: 24)
        - - - - - - - - Cloud Hosting Offers (Node ID: 25)
        - - - - - - - - Colo Hosting Offers (Node ID: 26)
        - - - - - - - - Backup Hosting Offers (Node ID: 41)
        - - - - - - - - Email Hosting Offers (Node ID: 42)
        - - - - - - - - Other Hosting Offers (Node ID: 43)
        - - - - - - Other Offers (Node ID: 57)
        - - - - - - - - Server Management (Node ID: 58)
        - - - - - - - - Domain Names (Node ID: 59)
        - - - - - - - - Employment (Node ID: 60)
        - - - - - - - - Web Design (Node ID: 61)
        - - - - - - - - Software & Scripts (Node ID: 62)
        - - - - - - - - Marketing (Node ID: 63)
        - - - - - - - - SEO (Node ID: 64)
        - - - - - - - - SEM (Node ID: 65)
        - - - - - - - - Affiliate Programs (Node ID: 69)

        I don't need any of those to be included in the results when a visitor or member uses the "Today's Posts" link in the navigation menu.
        Web Hosting Forum | Fastest Hosting | Backup Storage

        Comment

        • Wayne Luke
          vBulletin Technical Support Lead
          • Aug 2000
          • 73981

          #5
          Should be able to create your array based on the category parent nodes and add it right before the closing brace:

          Code:
          search?searchJSON={"date":{"from":"lastDay"},"view":"topic","sort":{"lastcontent":"desc"},"exclude":[35],"exclude_type":["vBForum_PrivateMessage","vBForum_VisitorMessage","vBForum_Report","vBForum_Redirect"]}
          Little more human readable. The entire string doesn't have to be encoded for it to work. If encoded to the minimum needed it would look like this:

          Code:
          search?searchJSON={"date":{"from":"lastDay"},"view":"topic","sort":{"lastcontent":"desc"},"exclude":[35],"exclude_type":["vBForum_PrivateMessage","vBForum_VisitorMessage","vBForum_Report","vBForum_Redirect"]}
          Translations provided by Google.

          Wayne Luke
          The Rabid Badger - a vBulletin Cloud demonstration site.
          vBulletin 5 API

          Comment

          • webgeek247
            Senior Member
            • Mar 2006
            • 291
            • 5.7.X

            #6
            Originally posted by Wayne Luke
            Should be able to create your array based on the category parent nodes and add it right before the closing brace:

            Code:
            search?searchJSON={"date":{"from":"lastDay"},"view":"topic","sort":{"lastcontent":"desc"},"exclude":[35],"exclude_type":["vBForum_PrivateMessage","vBForum_VisitorMessage","vBForum_Report","vBForum_Redirect"]}
            Little more human readable. The entire string doesn't have to be encoded for it to work. If encoded to the minimum needed it would look like this:

            Code:
            search?searchJSON={"date":{"from":"lastDay"},"view":"topic","sort":{"lastcontent":"desc"},"exclude":[35],"exclude_type":["vBForum_PrivateMessage","vBForum_VisitorMessage","vBForum_Report","vBForum_Redirect"]}
            Thanks for your help with this Wayne, but I tried the first line of code and it doesn't seem to work as the Topics from the Advertising forums are still being included. I'm not sure why it isn't working as it's supposed to.
            Web Hosting Forum | Fastest Hosting | Backup Storage

            Comment

            • webgeek247
              Senior Member
              • Mar 2006
              • 291
              • 5.7.X

              #7
              I figured it now. When using site builder I had to use encoded code from last the line. Encoded code is needed for it to work.
              Web Hosting Forum | Fastest Hosting | Backup Storage

              Comment

              • webgeek247
                Senior Member
                • Mar 2006
                • 291
                • 5.7.X

                #8
                Yes. It's working now! Thanks Wayne.
                Web Hosting Forum | Fastest Hosting | Backup Storage

                Comment

                • Wayne Luke
                  vBulletin Technical Support Lead
                  • Aug 2000
                  • 73981

                  #9
                  You're welcome.
                  Translations provided by Google.

                  Wayne Luke
                  The Rabid Badger - a vBulletin Cloud demonstration site.
                  vBulletin 5 API

                  Comment

                  • Mrs.T
                    Senior Member
                    • Nov 2007
                    • 1210
                    • 6.0.X

                    #10
                    Edit: because I finally found where to edit the search

                    However this is our search string:

                    search?searchJSON=%7B%22last%22%3A%7B%22from%22%3A%22lastDay%22%7D%2C%22view%22%3A%22topic %22%2C%22starter_only%22%3A+1%2C%22sort%22%3A%7B%22lastcontent%22%3A%22desc%22%7D%2C%22exc lude_type%22%3A%5B%22vBForum_PrivateMessage%22%5D%7D

                    it looks nothing like the previous posts. Do I just add %nodeid% to it?
                    Last edited by Mrs.T; Tue 10 Jul '18, 5:00am.

                    Comment


                    • In Omnibus
                      In Omnibus commented
                      Editing a comment
                      In the Search Module you have to switch to the advanced editor to see the search JSON field.

                    • Mrs.T
                      Mrs.T commented
                      Editing a comment
                      Strange, I still don't see the advanced editor when I look in the search module. Maybe it's not something that can be accessed on Cloud?
                  • Mrs.T
                    Senior Member
                    • Nov 2007
                    • 1210
                    • 6.0.X

                    #11
                    Thanks In Omnibus, I just came back and edited my post as I found the string in the "navigation" page, but still can't work out what to add as the string isn't the same as the example Wayne gave.

                    Comment

                    • In Omnibus
                      Senior Member
                      • Apr 2010
                      • 2310

                      #12
                      Originally posted by MrsTiggywinkle
                      Thanks In Omnibus, I just came back and edited my post as I found the string in the "navigation" page, but still can't work out what to add as the string isn't the same as the example Wayne gave.
                      Depending on what you want to exclude you should be able to add something like the following right before the closing bracket ] and parenthesis )
                      ,"exclude":[35],"exclude_type":["vBForum_PrivateMessage","vBForum_VisitorMessage","vBForum_Report","vBForum_Redirect"

                      The number (or numbers, separated by commas) in the first bracket would be any individual nodes you want to exclude.

                      The types are, of course, to exclude certain types of content from the search.

                      Comment

                      • Mrs.T
                        Senior Member
                        • Nov 2007
                        • 1210
                        • 6.0.X

                        #13
                        Originally posted by In Omnibus

                        Depending on what you want to exclude you should be able to add something like the following right before the closing bracket ] and parenthesis )
                        ,"exclude":[35],"exclude_type":["vBForum_PrivateMessage","vBForum_VisitorMessage","vBForum_Report","vBForum_Redirect"

                        The number (or numbers, separated by commas) in the first bracket would be any individual nodes you want to exclude.

                        The types are, of course, to exclude certain types of content from the search.
                        That makes sense and thanks so much for your help but we don't appear to have any brackets or parenthesis, this is our code.... or maybe I've misunderstood?

                        search?searchJSON=%7B%22last%22%3A%7B%22from%22%3A%22lastDay%22%7D%2C%22view%22%3A%22topic %22%2C%22starter_only%22%3A+1%2C%22sort%22%3A%7B%22lastcontent%22%3A%22desc%22%7D%2C%22exc lude_type%22%3A%5B%22vBForum_PrivateMessage%22%5D%7D


                        All we want to do is exclude one forum node id 282739

                        Comment

                        • Wayne Luke
                          vBulletin Technical Support Lead
                          • Aug 2000
                          • 73981

                          #14
                          In current versions the strings I posted above should work. The difference is that the string you have is fully encoded and that isn't necessary.
                          Translations provided by Google.

                          Wayne Luke
                          The Rabid Badger - a vBulletin Cloud demonstration site.
                          vBulletin 5 API

                          Comment

                          • Mrs.T
                            Senior Member
                            • Nov 2007
                            • 1210
                            • 6.0.X

                            #15
                            Originally posted by Wayne Luke
                            In current versions the strings I posted above should work. The difference is that the string you have is fully encoded and that isn't necessary.
                            OK thanks Wayne. It was just like that when we moved to Cloud so I left it - I don't mess with things I don't understand.

                            I will try your version with an addition to exclude the one we want.

                            Comment

                            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                            Working...