We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21395
    • 91 Posts
    I am rebuilding a website, which uses 0.9.6.1 and AjaxSearch 1.5.1, with the latest versions of AjaxSearch and Modx. The search function is installed "out of the box", and called as [!Ajaxsearch!] (snippet) in a chunk in a template. I have <base href="[(site_url)]" /> in the <head> tag.

    The "old" pairing works fine, the new one doesn’t:

    A search makes two images appear - the cross and the whirling indicator, but no results are returned.

    The go button also greys out, and no alternative search term can be entered, and to make the search form refresh itself, I have to close and reload the browser. A refresh doesn’t work. I get the same result in Firefox and IE7.

    Old site is http://www.boyde.com. New site is http://mdx.stormforcemarine.com in case you want to admire the whirling indicator. As far as I can tell, the configurations of the two sites are identical, all pages cacheable and searchable etc.

    I’ve searched the forums, and found only one reference to this symtom before - apparently solved by inserting the <base href...> field. Which isn’t apparently my problem.

    Any ideas anyone?
      MODX Revolution 2.6.5-pl (traditional)

      Hosted on MODX Cloud

      Skype: nicbaldeagle
      • 29357
      • 35 Posts
      Same for me too after migrating a site to a new server. All my other sites work including one I cloned this from. Its a mystery and 1.8 does not solve it although changing to standard search (non ajax) does. Will report if I find it. Whats this base href have to do with it?

      Julian
        • 5811
        • 1,717 Posts
        @Nicboyde

        On the site http://mdx.stormforcemarine.com, I get the error 404 when I try to search the file http://mdx.stormforcemarine.com/index-ajax.php
        You could see that using firebug or httpfox under firefox.

        Could you check that this file exists at the root of your site. And verify that you haven’t any redirection by .htaccess file

        And takes care the correct snippet call is [!AjaxSearch!] not [!Ajaxsearch!]
          • 21395
          • 91 Posts
          Thank you for your reply.

          We progress: the missing index-ajax.php file has been found and installed: I can’t understand why the file wasn’t ftp’d with the rest - but ftp is dodgy at best. It’s there now. I wonder what else didn’t install... For the record, the .htaccess file
          wasn’t re-directing/re-writing, and I was using the correct [!AjaxSearch!] snippet call. And to respond to tazzydemon: the hrefbaseurl issue related to a previous post on a similar topic, buried at the end of 40 pages of posts, and I wanted to make clear that this wasn’t my particular problem...


          Anyway, having put the index-ajax.php file into the root and repeating the test,  the search engine responded with:

          « MODx Parse Error »

          MODx encountered the following error while attempting to parse the requested resource:

          « Execution of a query to the database failed - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ’( DISTINCT CAST(ntv.id AS CHAR) SEPARATOR "," ) AS tv_id, GROUP »
                SQL: SELECT sc.id, sc.pagetitle, sc.longtitle, sc.description, sc.alias, sc.introtext, sc.menutitle, sc.content, sc.publishedon, GROUP_CONCAT( DISTINCT CAST(ntv.id AS CHAR) SEPARATOR "," ) AS tv_id, GROUP_CONCAT( DISTINCT ntv.value SEPARATOR ", " ) AS tv_value FROM `site_content` sc LEFT JOIN( SELECT DISTINCT tv.id, tv.value, tv.contentid FROM `site_tmplvar_contentvalues` tv WHERE (((tv.value LIKE ’%lights%’))) ) AS ntv ON sc.id = ntv.contentid WHERE ((sc.published=1) AND (sc.searchable=1) AND (sc.deleted=0) AND (sc.type=’document’) AND (sc.privateweb=0)) GROUP BY sc.id HAVING (((sc.pagetitle LIKE ’%lights%’) OR (sc.longtitle LIKE ’%lights%’) OR (sc.description LIKE ’%lights%’) OR (sc.alias LIKE ’%lights%’) OR (sc.introtext LIKE ’%lights%’) OR (sc.menutitle LIKE ’%lights%’) OR (sc.content LIKE ’%lights%’) OR (tv_value LIKE ’%lights%’))) ORDER BY sc.publishedon,sc.pagetitle

          Which is another problem entirely.

          Unless you’ve already seen this kind of response, and can instantly put your finger on the issue, let me do some research before bothering further. If I can’t fix it, I’ll raise the matter in the appropriate forum, if this isn’t it.


          Thanks again.
            MODX Revolution 2.6.5-pl (traditional)

            Hosted on MODX Cloud

            Skype: nicbaldeagle
            • 5811
            • 1,717 Posts
            Check your mysql version and look at this post

            Your select is correct. To avoid the group concat with the tv_content try for instance to add the parameter &whereSearch=`content` in your AS snippet call. This which restrict the search to the document and avoid the search in TV (by default search occurs in "content|tv".
              • 21395
              • 91 Posts
              I’m using MySQL 4.0.26a on this particular server.

              Following your advice I went to the snippet code, under Resources/Manage Resources/Snippets and edited out the |tv at the end of the line:
              $cfg[’whereSearch’] = isset($whereSearch) ? $whereSearch : (isset($__whereSearch) ? $__whereSearch : ’content|tv’);, so it reads ...’content’);

              And it works. Voila!

              Can I suggest that the distribution be changed so that this is the default? I would imagine that most users of MODx websites (as opposed to developers) don’t want to search TVs - and if the site developers do decide to populate TVs with content (why?), the developers can add it back in.

              Any way - this is something I leave to you. Thanks and merci again.
                MODX Revolution 2.6.5-pl (traditional)

                Hosted on MODX Cloud

                Skype: nicbaldeagle
                • 25663 MODX Staff
                • 12,272 Posts
                For pretty much any site I’ve built, not being able to search in TVs is a huge limitation. Searching in TVs *should* be the default behavior.
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 5811
                  • 1,717 Posts
                  @Nicboyde

                  From my point of view, the main difference between the version 1.6 of AjaxSearch (The first version that I investiguated one year ago) and the current 1.8.1 is the feasability to really do a search in TV but also in Jot, Maxigallery or in a custom table.
                  Unfortunately, these kind of search, need to use the "GROUP_CONCAT" sql statement. And this statement, which is not often used by Mysql developers, has some issues for some Mysql versions and needs at leat a version >4.1
                  But, as it is really a strong request, to do a correct search in TV, jot or maxigallery, I prefer bet on the correction of Mysql version, rather to limit AS.
                  In any case, you could disengage the seach into TV, simply by adding: $whereSearch=’content’ in your default configuration file.

                  Any way, thanks for this feed back. Your French is pretty good wink