We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20532
    • 14 Posts
    I was hoping someone could point me in the right direction...

    I recently implemented AjaxSearch, and all is well regarding searching standard content fields. A few of my templates have a template variable called "term" assigned to them, which I use for folksonomy. I’ve repeatedly attempted different ways to include TVs in the search results, but to no avail. AFIK, TVs are searched by defualt. If I explicitly call for just TVs (which there are quite a few of) to be searchable in the &whereSearch parameter, I never get results.

    Any clues?
      • 5811
      • 1,717 Posts
      If I explicitly call for just TVs (which there are quite a few of) to be searchable in the &whereSearch parameter, I never get results.
      Have you try to add &withTvs=`term` to limit the search to the Tvs named "term" ?

      ---- &withTvs (optional)
      Define which Tvs are used for the search in Tvs
      a comma separated list of TV names
      by default all TVs are used (empty list)
        • 20532
        • 14 Posts
        Quote from: coroico at May 27, 2009, 03:33 PM

        Have you try to add &withTvs=`term` to limit the search to the Tvs named "term" ?

        Hi coroico,

        Yes, I tried that. Here’s the entire snippet I edited:

         [!AjaxSearch? ajaxSearch=`1` &liveSearch=`1` &debug=`-3` &whereSearch=`tv` &withTvs=`tags` &highlightResult=`0` &AS_landing=`119` 
        &moreResultsPage=`119` &showMoreResults=`1` &extract=`0` &addJscript=`0` &AS_showResults=`1` &jScript=`jquery` &jsJquery=`/assets/js/jquery-1.3.2.min.js` !]


        For testing, I assigned a page the tv ("tags") a value of "Foobar". When I search for "Foobar" nothing returns. I’d like to paste the generated SQL for you, but it doesn’t seem to show up in the firebug console when I limit the &whereSearch with parameters.

        Thanks for your help!
          • 20532
          • 14 Posts
          Here’s the generated SQL (I removed the &whereSearch parameter):

           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 `modx_site_content` sc
          LEFT JOIN (
          
          SELECT DISTINCT tv.id, tv.value, tv.contentid
          FROM `modx_site_tmplvar_contentvalues` tv
          INNER JOIN `modx_site_tmplvars` tmpl ON tv.tmplvarid = tmpl.id
          WHERE (
          (
          (
          tmpl.name
          IN (
          'tags'
          )
          )
          )
          AND (
          (
          tv.value LIKE '%Foobar%'
          )
          )
          )
          ) 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 '%Foobar%'
          )
          OR (
          sc.longtitle LIKE '%Foobar%'
          )
          OR (
          sc.description LIKE '%Foobar%'
          )
          OR (
          sc.alias LIKE '%Foobar%'
          )
          OR (
          sc.introtext LIKE '%Foobar%'
          )
          OR (
          sc.menutitle LIKE '%Foobar%'
          )
          OR (
          sc.content LIKE '%Foobar%'
          )
          OR (
          tv_value LIKE '%Foobar%'
          )
          )
          )
          ORDER BY sc.publishedon, sc.pagetitle
          
            • 20532
            • 14 Posts
            For the test, the search problem was a result of a user who switched the page to not searchable. Gah. rolleyes

            That said, I may have discovered a problem with comma delimited tags. More to follow...
              • 19975
              • 429 Posts
              has anyone found a solution? this seems related to my experienced problems sad
                Martin Sanders - Design & Web Development