We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24676
    • 60 Posts
    Hi

    I am having a problem with simpleSearch exclude parameter

    [[!SimpleSearch? &exclude=`2`]]

    This doesn't exclude the resource from the search results. Has anyone else had this problem?

    I am using 2.3.2 Revo
    Simple Search 1.9.1
      • 46309
      • 79 Posts
      Try with ids - A comma-separated list of IDs to restrict the search to (http://rtfm.modx.com/extras/revo/simplesearch/simplesearch.simplesearch):

      [[!SimpleSearch? &ids=`3`]] - you have to put the id of the resource you are searching in.

      If you have subfolders/subresouces you don't need to include them, just the parent/root resource.
        peace&love / bike&ride
        • 24676
        • 60 Posts
        thanks for the reply. What happens when the client adds new resources though. If it's not included in my snippet it won't be searchable?

        Do we know why the exclude parameter might not be working?

          • 46309
          • 79 Posts
          Yeah, unfortunately if the client adds new resource and if this resource is in the root, it should be definitely included in the snippet in order to be searchable.

          I don't know why the &exclude is not working. I tried it and it didn't worked for me also, that's why I used the &ids parameter.

          Maybe somebody can tell us where the problem is or if we are doing something wrong.
            peace&love / bike&ride
            • 31902
            • 342 Posts
            Same here. Anyone ever find a solution to this?

            In my case, the search is pulling from the RSS page. It then shows the result title (the RSS resource) and the words

            ? &scheme=`full` 120

            ...under the title. I want to exclude the RSS page ID from any kind of search.

            Thanks in advance.

            MODx Revo 2.3.3
            SimpleSearch 1.9.2-pl
              • 24374
              • 322 Posts
              Any update on this? I just installed SimpleSearch and exclude is not working.
                • 24374
                • 322 Posts
                OK, here's the story. As the programming is set up right now, exclude works ONLY if you also use "ids" to set the list of ids to search. That makes no sense at all! Here's the fix:

                On line 191 of core/components/simplesearch/model/simplesearch/driver/simplesearchdriverbasic.class.php, add this line:

                $c->where(array("id:NOT IN" => explode(',', $exclude)),xPDOQuery::SQL_AND,null,$whereGroup);


                  • 53156
                  • 1 Posts
                  Great...I was looking for this and it works, thanx!