On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • I'm using Modx Evo 1.0.6 along with AjaxSearch 1.9.2. AjaxSearch is working albeit very slowly.

    Here is my AjaxSearch call:
    [!AjaxSearch? &liveSearch=`1` &parents=`32,33,34,35`&depth=`1`&jscript=`jquery` &jsJquery=`assets/js/jquery-1.3.2.min.js` &debug=`3`!]


    And my debug file:
    http://pastebin.com/kW9NH2gG

    It's taking an average of 45 seconds to return any results. I pared down the Array at the bottom of the debug file as it appears that it is grabbing a lot of the page content. Could this be slowing it down? How can I limit it to only specific TVs and ignoring page content? I tried using &whereSearch=`tv` but then it stopped returning any results.

    Thanks for your help.
    • See here the Cheat Sheet.
      Try &whereSearch=`` parameter. Example: &whereSearch=`content:pagetitle,longtitle,content`
      • Try
        [!AjaxSearch? &liveSearch=`1` &parents=`32,33,34,35` &depth=`1` &jscript=`jquery` &jsJquery=`assets/js/jquery-1.3.2.min.js` &whereSearch=`content:null` &withTvs=`yourTvName` !]


        By using &whereSearch=`content:null`, you exclude the search in document fields
        By adding &withTvs=`yourTvName` you search only in the tv named 'yourTvName'

        And if needed, rather to use @FILE:assets/snippets/ajaxSearch/templates/ ... for each template, try to use chunks.

        And obviously, remove the debug mode in production.
        • Wow! It works and it's so fast! Thank you!
          • I'm also running into an extremely slow live search. It's a rather complex advanced search setup. The page already loads jquery; I'm not sure how to stop AjaxSearch from trying to load it again.

            I suspect that the config setup I had prior to adding the ajaxSearch (for live search) isn't working properly, but I'm not sure how to set up an advanced search with live search if I don't really want the ajax search results.

            [!ajaxSearch? &ajaxSearch=`1` &jscript=`jquery` &liveSearch=`1` &config=`custom` &showInputForm=`1` &highlightResult=`1` &minChars=`2` &tplInput=`advancedSearchTpl` &advSearch=`allwords` &clearDefault=`1`!]


            The custom config:
            <?php
            if(isset($_POST['parents'])){
            	$dcfg['parents'] = $_POST['parents'];
            	$modx->setPlaceholder("as.selected", $_POST['parents']);
            } else {
                $dcfg['parents'] = '257';
            }
            ?>
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org