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

    I included a TV to all my pages. And when I search for, say "massage", it displays ALL my pages because the word "massage" is in the TV on all page.

    Is it possible to avoid/refrain TV in ajaxsearch?
      • 26016
      • 561 Posts
      Hi,
      I would suggest looking at &withTvs on this page:

      http://wiki.modxcms.com/index.php/AjaxSearch#General_Parameters

      There appears to be a parameter with that for excluding (or including, etc.) TV’s.
      I’m guessing that this documentation is ancient, but it’s probably worth a try.

      Good luck, Dave
        MODx and Wordpress development
        Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
        • 4078
        • 31 Posts
        Hi Dave

        Thanks for the answer, but I get an error when I do that.

        « 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 'FROM `kbhkis_site_content` sc LEFT JOIN( SELECT DISTINCT tv.id, tv.value, tv.con' at line 1 »
              SQL: SELECT sc.id, sc.pagetitle, sc.longtitle, sc.description, sc.alias, sc.introtext, sc.template, 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, ntv1.value AS FROM `kbhkis_site_content` sc LEFT JOIN( SELECT DISTINCT tv.id, tv.value, tv.contentid FROM `kbhkis_site_tmplvar_contentvalues` tv ) AS ntv ON sc.id = ntv.contentid LEFT JOIN( SELECT DISTINCT tv1.contentid , tv1.value FROM `kbhkis_site_tmplvar_contentvalues` tv1 WHERE tv1.tmplvarid = '' ) AS ntv1 ON sc.id = ntv1.contentid WHERE ((sc.published=1) AND (sc.searchable=1) AND (sc.deleted=0) AND (sc.privateweb=0)) GROUP BY sc.id HAVING (((sc.pagetitle LIKE '%succes%') OR (sc.longtitle LIKE '%succes%') OR (sc.description LIKE '%succes%') OR (sc.alias LIKE '%succes%') OR (sc.introtext LIKE '%succes%') OR (sc.menutitle LIKE '%succes%') OR (sc.content LIKE '%succes%') OR (tv_value LIKE '%succes%') OR ( LIKE '%succes%'))) ORDER BY sc.publishedon,sc.pagetitle 


        This is my call

        [!AjaxSearch? &ajaxSearch=`0` &showInputForm=`1` &grabMax=`10` &extract=`0` &withTvs=`-:leftbtm,rightbtm`!]

          • 5811
          • 1,717 Posts
          This a bug. The sql statement is not complete, you got:

          SELECT sc.id, sc.pagetitle, sc.longtitle, sc.description, sc.alias, sc.introtext, sc.template, 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, ntv1.value AS 
          FROM `kbhkis_site_content` sc  .....
          Something is missing after ntv1.value AS

          Which is your Php version ?
          This bug recall me something, but I need to check, if I have corrected this issue with the release 1.9.1

          To avoid a search in TVs simply use &whereSearch=`content` instead of withTvs.
            • 4078
            • 31 Posts
            I guess it is PHP5.

            &whereSearch=`content` did the job, thanks man! smiley