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

    We are currently trying to implement AjaxSearch on a MODx Evolution site which has over 2,300 documents, we would like the search to work across the content and TV, each page has around 7 TV's.

    When we search at the moment it is really slow, I suspect because it is doing a lot of db queries at the same time, when we limit the search to content only it runs quick.

    Any tips on how to speed up the AjaxSearch? I'm currently thinking that I might have to run a cron job each day which GROUP_CONCACT the TV's for each page and adds them to the MODx document description, comma separated but I was wondering if there is an out of the box way to speed boost this?

    Thanks Aaron
      UK MODX Hosting with love.
      • 33968
      • 863 Posts
      The problem is definitely the fact that your data is stored in 7 TVs, all of which have to be joined on themselves to include them in the search. That's very slow.

      What kind of data is held in the TVs? You might be better off putting it into a custom table - or the cron job as suggested might work as well.
        • 5811
        • 1,717 Posts

        The performances depend mainly of how is set up the request. As soon as you have a huge volume of documents, it is preferable to disallow the group concat by setting whereSearch=`content` and preferrably use the withTvs and tvPhx parameters.

        Since I have developed AdvSearch for Revolution I know how I could improve the speed of some complex requests. I did some tests with a database of 430 documents. With 74 search results and 4 tvs. I have divided by about 4 the execution time of the sql request (compared to the group_concat) and by 2 (by using withTvs & tvPhx).

        But this is really tricky to explain on a post. And to be effective this will imply to rewrite a part of ajaxSearchResult class. And I have no idea what could be the real impact on huge volume of documents (2000+).

        This is why I am interested to do some sql tests with you on your database. I sent you a personal message about this post.

          • 26163
          • 43 Posts

          I have also encountered the problem where ajax search does not simply work. I have somewhere around 1500 documents and using ajax search encounters the 500 Internal Server Error. I tried using the parameter &whereSearch=`content` but still no success.

          I am using Modx Evo 1.0.13 and using somewhere 20 TVs.

          Can you please help me?