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

    I think there is a bug with the &filter parameter. I set &filter=`template,18,2` which should exclude all pages that use template id=18. Yet it still shows the documents. Looking at the log files (with debug=1) shows that the sql query is not changed when the filter is set.

    Can anyone confirm?

    I am using modx 1.0 with ajaxsearch 1.8.3
      • 12028
      • 152 Posts
      You are not alone - I got the same problem, and haven’t any solution...
        - A small step for mankind, so why not take two...

        Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!
        • 5811
        • 1,717 Posts
        You are right, when "parents" or "documents" parameters aren’t initialized to any id, the filter parameter doesn’t work undecided
        This configuration is not tested on the ajaxSearch demo site because I always use the "parents" parameter to set to English or French documents. So I never noticed this issue.

        Is somebody do the following test (I have done it but I would like an another independent test) ? Thanks for your feeback.

        1°/ in the classes/search.class.inc.php around the line 1333, change the line
            if (!strlen($this->listIDs)) return;     // listIDs ='' means all documents
        by
            if (!strlen($this->listIDs) && !$this->cfg['filter']) return;     //! listIDs ='' means all documents
        and then
        2°/ adds the template parameter in the displayed fields list. For that, always in the search.class.inc.php file around the line 568 replace the line
                       'displayed' => array('pagetitle','longtitle','description','alias','introtext','menutitle','content'),
        by
                      'displayed' => array('pagetitle','longtitle','description','alias','introtext','template','menutitle','content'),
        Thanks for your feedback about this fix.


        Issue registered as AJAXSEARCH-47
          • 12028
          • 152 Posts
          Hello Coroico,

          Thanks for your work!

          But when trying your patch, I got this error, when performing a search:

          Fatal error: Call to undefined method DocumentParser::getRecordCount() in /home/www/domain.tld/assets/snippets/ajaxSearch/classes/search.class.inc.php on line 1360


          I’m on a server with:
          PHP Version 5.3.0/CGI/FastCGI
          MySQL client version: 5.0.32
            - A small step for mankind, so why not take two...

            Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!
            • 5811
            • 1,717 Posts
            @Henrik - This issue has been coorected with the fix AJAXSEARCH-39

            AJAXSEARCH-39 - Call to undefined method DocumentParser::getRecordCount()

            Around line 1360 replace:
            if ($modx->getRecordCount($rs) > 0){
            by
            if ($modx->db->getRecordCount($rs) > 0){ 
              • 12028
              • 152 Posts
              @coroico:

              Sorry for that!

              Now it works for me, including the filter parameters!

              Again: Thanks for your patch!
                - A small step for mankind, so why not take two...

                Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!
                • 5811
                • 1,717 Posts
                Ok Thanks. I will integrate this fix in the next release of AjaxSearch.
                  • 14617
                  • 47 Posts
                  I can also confirm that this works. Thanks guys!