We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4172
    • 5,888 Posts
    If you got the latest (modified) version of my code above, you can try with

    &debug=`1` and copy the generated sql-query.

    Than you can see, what happens when you paste that query to phpmyadmin and run it there.


    Are all resources, which you want to search, direct children of the parent '3' ?
      -------------------------------

      you can buy me a beer, if you like MIGX

      http://webcmsolutions.de/migx.html

      Thanks!
      • 8822
      • 203 Posts
      HI Bruno, In answer to your question about the resources being children of the parent resource 3, the answer is 'no', they are all categorised in sub-folders of resource 3. I did have set &depth=2 using the standard SimpleSearch call and this searched down to that level - does your code do the same?
        • 4172
        • 5,888 Posts
        ok, then remove the

        &where=`{"parent":"3"}`


        property, this was just a example for how the &where-property can be used.
        and use the default 'ids' - property.
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 8822
          • 203 Posts
          Hi Bruno, i now have the following, but that is still not working. Do i need the &includeTVs or &includeContent?
          [[!SimpleSearch?
          &parents=`3`
          &depth=`2`
          &sisea.driver_class=`simplesearchdriverresourcescustom`
          &sisea.driver_db_specific=`0`
          &searchTvs = `metaKeywords,businessname,businessaddress1,businesscounty,businesstown,businessemail,categories`
          &limit=`10`
          &pageVarKey=`page`
          &useAllWords=`1`
          &sortBy=`link_attributes`
          &sortDir=`DESC`
          &tpl=`fbnsearchresultstpl`
          ]]

          what i did have with using standard SimpleSearch was:
          [[!getPage?
             &elementClass=`modSnippet`
             &element=`SimpleSearch`
            
             &parents=`3`
             &depth=`2`
             &limit=`10`
             &pageVarKey=`page`
             &useAllWords=`1`
            
             &includeTVs=`1`
             &includeContent=`1`
          
             &sortBy=`link_attributes`
             &sortDir=`DESC`
             &tpl=`fbnsearchresultstpl`
          ]]
            • 4172
            • 5,888 Posts
            Quote from: Bruno17 at Nov 27, 2013, 12:46 PM
            If you got the latest (modified) version of my code above, you can try with
            &debug=`1` and copy the generated sql-query.
            Than you can see, what happens when you paste that query to phpmyadmin and run it there.

            additional paste the generated sql-query here
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 8822
              • 203 Posts
              Hi Bruno, this is the generated SQL Query - shed any light on what the issue may be??

              SELECT DISTINCT `modResource`.`id`, `modResource`.`type`, `modResource`.`contentType`, `modResource`.`pagetitle`, `modResource`.`longtitle`, `modResource`.`description`, `modResource`.`alias`, `modResource`.`link_attributes`, `modResource`.`published`, `modResource`.`pub_date`, `modResource`.`unpub_date`, `modResource`.`parent`, `modResource`.`isfolder`, `modResource`.`introtext`, `modResource`.`content`, `modResource`.`richtext`, `modResource`.`template`, `modResource`.`menuindex`, `modResource`.`searchable`, `modResource`.`cacheable`, `modResource`.`createdby`, `modResource`.`createdon`, `modResource`.`editedby`, `modResource`.`editedon`, `modResource`.`deleted`, `modResource`.`deletedon`, `modResource`.`deletedby`, `modResource`.`publishedon`, `modResource`.`publishedby`, `modResource`.`menutitle`, `modResource`.`donthit`, `modResource`.`privateweb`, `modResource`.`privatemgr`, `modResource`.`content_dispo`, `modResource`.`hidemenu`, `modResource`.`class_key`, `modResource`.`context_key`, `modResource`.`content_type`, `modResource`.`uri`, `modResource`.`uri_override`, `modResource`.`hide_children_in_tree`, `modResource`.`show_in_tree`, `modResource`.`properties`, `TVbusinessname`.`id` AS `TVbusinessname_id`, `TVbusinessname`.`tmplvarid` AS `TVbusinessname_tmplvarid`, `TVbusinessname`.`contentid` AS `TVbusinessname_contentid`, `TVbusinessname`.`value` AS `TVbusinessname_value`, `TVbusinessaddress1`.`id` AS `TVbusinessaddress1_id`, `TVbusinessaddress1`.`tmplvarid` AS `TVbusinessaddress1_tmplvarid`, `TVbusinessaddress1`.`contentid` AS `TVbusinessaddress1_contentid`, `TVbusinessaddress1`.`value` AS `TVbusinessaddress1_value`, `TVbusinesscounty`.`id` AS `TVbusinesscounty_id`, `TVbusinesscounty`.`tmplvarid` AS `TVbusinesscounty_tmplvarid`, `TVbusinesscounty`.`contentid` AS `TVbusinesscounty_contentid`, `TVbusinesscounty`.`value` AS `TVbusinesscounty_value`, `TVbusinesstown`.`id` AS `TVbusinesstown_id`, `TVbusinesstown`.`tmplvarid` AS `TVbusinesstown_tmplvarid`, `TVbusinesstown`.`contentid` AS `TVbusinesstown_contentid`, `TVbusinesstown`.`value` AS `TVbusinesstown_value`, `TVbusinessemail`.`id` AS `TVbusinessemail_id`, `TVbusinessemail`.`tmplvarid` AS `TVbusinessemail_tmplvarid`, `TVbusinessemail`.`contentid` AS `TVbusinessemail_contentid`, `TVbusinessemail`.`value` AS `TVbusinessemail_value`, `TVcategories`.`id` AS `TVcategories_id`, `TVcategories`.`tmplvarid` AS `TVcategories_tmplvarid`, `TVcategories`.`contentid` AS `TVcategories_contentid`, `TVcategories`.`value` AS `TVcategories_value` FROM `modx_site_content` AS `modResource` LEFT JOIN `modx_site_tmplvar_contentvalues` `TVbusinessname` ON Tags.contentid=modResource.id AND Tags.tmplvarid=2 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVbusinessaddress1` ON Tags.contentid=modResource.id AND Tags.tmplvarid=29 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVbusinesscounty` ON Tags.contentid=modResource.id AND Tags.tmplvarid=32 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVbusinesstown` ON Tags.contentid=modResource.id AND Tags.tmplvarid=31 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVbusinessemail` ON Tags.contentid=modResource.id AND Tags.tmplvarid=4 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVcategories` ON Tags.contentid=modResource.id AND Tags.tmplvarid=1 WHERE ( ( `modResource`.`pagetitle` LIKE '%karen%' OR `modResource`.`longtitle` LIKE '%karen%' OR `modResource`.`alias` LIKE '%karen%' OR `modResource`.`description` LIKE '%karen%' OR `modResource`.`introtext` LIKE '%karen%' OR `modResource`.`content` LIKE '%karen%' OR `TVbusinessname`.`value` LIKE '%karen%' OR `TVbusinessaddress1`.`value` LIKE '%karen%' OR `TVbusinesscounty`.`value` LIKE '%karen%' OR `TVbusinesstown`.`value` LIKE '%karen%' OR `TVbusinessemail`.`value` LIKE '%karen%' OR `TVcategories`.`value` LIKE '%karen%' ) AND `modResource`.`id` != 0 AND `modResource`.`id` != 0 AND ( `modResource`.`published` = 1 AND `modResource`.`searchable` = 1 AND `modResource`.`deleted` = 0 AND `modResource`.`context_key` IN ('web') ) ) ORDER BY modResource.link_attributes DESC LIMIT 10
                • 4172
                • 5,888 Posts
                it does!

                I changed this wrong line:

                'on' => 'Tags.contentid=modResource.id AND Tags.tmplvarid=' . $tv_id . '');


                to

                'on' => $alias . '.contentid=modResource.id AND ' . $alias . '.tmplvarid=' . $tv_id);


                at the code, copy the whole code again and try it again, please.

                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 791
                  • 46 Posts
                  Bruno17. I had to tell you that you're a life-saver. This solution works perfectly. I'm using SimpleSearch in a site where I need to search for members of staff and a search for "John" was returning not only all the Johns, but the office in Johns Road. I am staggered that the default Simple Search doesn't have a parameter to restrict searching to certain TV's.

                  Anyhow your solution works perfectly.
                    Learning a little more each day.
                    • 8822
                    • 203 Posts
                    Hi Bruno, after much testing i finally updated my live system today with your solution for restricting the searching of TVs - works like a dream, thank you very much for your help, time and support.
                      • 46456
                      • 3 Posts
                      Hi,
                      I am using this same solution to set the priority of the search results. It works great, except a hyphen or apostrophe in the search term returns "no results". Any ideas what I am doing wrong?