We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25663 MODX Staff
    • 12,272 Posts
    Any progress on search results highlighting?

    Also, have you thought about making a switchable configuration parameter to turn it into a live search?
      Ryan Thrash, MODX Co-Founder
      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • 25663 MODX Staff
      • 12,272 Posts
      Quote from: rthrash at Mar 30, 2006, 02:19 AM

      In the code:
      function connectForAjax() {
          $database = '';
          $tblPrefix = '';
          $dbuser = '';
          $dbpass = '';
          $dbhost = 'localhost';
          $db = mysql_connect($dbhost,$dbuser,$dbpass) or die("cannot connect to database");
          $selected = @mysql_select_db($database, $db) or die ("cannot select database");
          return $tblPrefix;
      }
      


      Why would you not use the $modx->dbconfig[’configPieceHere’] stuff so there’s no manual intervention required?

      Or actually, why not include the config file to automatically retrieve the values:

      include_once (dirname(__FILE__).'../../../../manager/includes/config.inc.php');
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 15987
        • 786 Posts
        Quote from: rthrash at Mar 30, 2006, 02:46 AM

        Any progress on search results highlighting?

        Also, have you thought about making a switchable configuration parameter to turn it into a live search?

        I just got back from vacation last night, so I have not worked on the search highlighting yet. Hopefully I will get to it this week.

        By live search do you mean results as you type, or like the google search suggest?

        I will change the db connection stuff to include the existing file. I wasn’t sure where that info was and didnt take the time to look. But I will have to do it that way since when the ajax call is made the modx api is not available.

        Thanks for the tip.

        Kyle
          • 25663 MODX Staff
          • 12,272 Posts
          Welcome back Kyle. smiley

          In your absence, we’ve done a lot on this front and will be introducing a new file to facilitate Ajax calls to the DB at the root level of the distribution with the next release (index-ajax.php). Without this file, basedir issues on some PHP5 installs make it a no go. The good news is that we’ve now got it working requiring no manual configuration.

          We’re continuing to clean up and comment the code as we go through it, and may add a few configuration params as well. By livesearch, I mean something along the lines of the demo at gizax.it.

          I’ll package this up and get it to you by tomorrow. Don’t hesitate to PM me if it slips my mind!
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 15987
            • 786 Posts
            Quote from: rthrash at Apr 02, 2006, 08:14 AM


            In your absence, we’ve done a lot on this front and will be introducing a new file to facilitate Ajax calls to the DB at the root level of the distribution with the next release (index-ajax.php). Without this file, basedir issues on some PHP5 installs make it a no go. The good news is that we’ve now got it working requiring no manual configuration.

            We’re continuing to clean up and comment the code as we go through it, and may add a few configuration params as well.

            Wow! This sounds great. I will be looking forward to getting my hands on this!

            By livesearch, I mean something along the lines of the demo at gizax.it.

            So basically make it so that you don’t have to click anything to get it to search? It just starts searching as you type?
              • 25663 MODX Staff
              • 12,272 Posts
              That’s exactly what I’m talking about Kyle ... a delayed, automatic trigger to start the search. Hmmm... interesting parameter would to pass would be ’autostart’ and the value be a number which would then make the snippet know when to start searching.
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 15987
                • 786 Posts
                That sounds like a good idea. I am going to work on getting the search terms highlighting integrated and then will look at the live seach feature.

                I like the idea of passing in the delay time.
                  • 25663 MODX Staff
                  • 12,272 Posts
                     $ajaxSearch = (isset($ajaxSearch))? $ajaxSearch : 0;


                  I think this should default to 1; after all, we’re talking about an Ajax search. The logic on the search action should then include a test to make sure the scriptaculous/prototype library calls work. If not, it should output an error message stating that the libraries could not be found.

                  When it’s done, we should also then do a version that works with moo.ajax and moo.fx, as they’re much lighter. wink
                    Ryan Thrash, MODX Co-Founder
                    Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                    • 15987
                    • 786 Posts
                    Quote from: rthrash at Apr 03, 2006, 10:33 AM

                    I think this should default to 1; after all, we’re talking about an Ajax search. The logic on the search action should then include a test to make sure the scriptaculous/prototype library calls work. If not, it should output an error message stating that the libraries could not be found.

                    I defaulted the ajaxSearch to 0 so that you could use this snippet as the original, unless you wanted to use ajax. I was looking at the ajax as an added feature, so to use it you need to set the parameter. But thats just the way I thought it would be used.

                    Quote from: rthrash at Apr 03, 2006, 10:33 AM

                    When it’s done, we should also then do a version that works with moo.ajax and moo.fx, as they’re much lighter. wink

                    I have used the moofx package before and it is pretty nice. This would definatly make a good addition down the road.

                      • 25663 MODX Staff
                      • 12,272 Posts
                      Let’s just revert it so that the default behavior is Ajax search being on and turning it into a boring old regular search is optional tongue
                        Ryan Thrash, MODX Co-Founder
                        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me

                      This discussion is closed to further replies. Keep calm and carry on.