We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8416
    • 173 Posts
    Hello,
    I tried using the &searchStyle parameter. When I looked at the source document, the parameter was still showing ’partial’.
    [!AjaxSearch? &ajaxSearch=`1` &AS_landing=`8` &moreResultsPage=`8` &showMoreResults=`1` &addJscript=`0` &extract=`0` &AS_showResults=`0` &grabMax=`10` &searchStyle=`relevance`!]	
    


    So I changed the default in the snipped.ajaxSearch.inc.php file. I changed this line of code:
    $searchStyle = ’relevance’;
    After doing that I got a MODx parse sql error. Does any know about this? Thank you
    « 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 'sc WHERE MATCH (sc.pagetitle, sc.longtitle, sc.introtext, sc.description, sc.con' at line 1 »
          SQL: SELECT DISTINCT sc.id, sc.pagetitle, sc.description, sc.content, sc.introtext FROM `modx`.`modx_site_content` LEFT JOIN `modx`.`modx_site_tmplvar_contentvalues` stc ON sc.id = stc.contentid sc WHERE MATCH (sc.pagetitle, sc.longtitle, sc.introtext, sc.description, sc.content, stc.value) AGAINST ('mall') AND sc.privateweb = 0 AND sc.published = 1 AND sc.searchable=1 AND sc.deleted=0; 
    


      • 32646
      • 87 Posts
      I used the config file under ajaxsearch/config/default.config.php like this:
      <?php
      // Use the following syntax $param = 'value';
      $extractLength = 300;
      $useAllWords = 1;
      $showMoreResults = 1;
      $moreResultsPage = 240;
      $ajaxMax = 4;
      $minChars = 3;
      $searchStyle = 'relevence';
      ?>


      and it worked fine. Much better than hacking code that would have to be rehacked everytime you upgrade.

      Eric
        Just learning the ropes.
        • 8416
        • 173 Posts
        Yes, using the ajaxsearch/config/default.config.php is indeed better. Please note that the searchStyle is ’relevance’ with an ’a’ and not an ’e’.

        However, I still have a problem; for instance when I search for "mall", small will be grabed. This is not what I want, I’d like to be able to search for the word "mall" and not for every occurence of "mall" within words such as "small"
        Is it possible to do that with?
        Thank you

        Eric
          • 5811
          • 1,717 Posts
          The correct searchstyle parameter should be "relevance". But this parameter is not documented because this internal option doesn’t run undecided and i think that this never run at all

          So echaland, for the moment you can’t get "mall" without get words like "small" for example.

          The part of code regarding this parameter should be refactored to run fine. For the moment I haven’t enought time to do this. If you are interested to contribute, focus on the inc/ajaxSearch.inc.php file. look at initSearchString and doSearch functions.
            • 32646
            • 87 Posts
            Ooops, that’s what happens when you don’t preview.

            Now that I spelled correctly, even in the config file, this is what I get.

            Cannot query the database (SELECT DISTINCT sc.id, sc.pagetitle, sc.description, sc.content, sc.introtext FROM `modx_site_content` LEFT JOIN `modx_site_tmplvar_contentvalues` stc ON sc.id = stc.contentid sc WHERE MATCH (sc.pagetitle, sc.longtitle, sc.introtext, sc.description, sc.content, stc.value) AGAINST ('water') AND sc.id IN (243,47,355,179,201,202,236,199,200,180,223,214,229,203,191,185,196,197,186,195,192,193,190,189,187,181,188,194,182,184,183,226,224,225,227,219,220,215,216,218,217,221,230,235,232,234,231,204,212,209,210,211,207,208,206,205) AND sc.privateweb = 0 AND sc.published = 1 AND sc.searchable=1 AND sc.deleted=0;)


            Now I remember getting this error before. Like coroico says, it needs to be fixed.
              Just learning the ropes.
              • 8416
              • 173 Posts
              Thanks. Yes by looking at the code I figured out that it wasn’t implemented. If I find some time I’d like to have a look at it, but things are pretty busy right now...