We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20413
    • 2,877 Posts
    UPDATE: In AjaxSearch 1.9.2 it’s integrated and all you need to do is: &advSearch=`exactphrase`

    Here is what I needed to do:
    search.class.inc.php
    <?php //for highlighting
    function getWhereForm($advSearch){
        $whereForm = array(
          'like' => " LIKE '% word %'",
          'notlike' => " NOT LIKE '% word %'"
        );
    


    --> Add SPACES around %word% smiley


    ...This is even better:
    <?php // for highlighting 
      function getWhereForm($advSearch){
        $whereForm = array(
          'like' => " REGEXP '[[:<:]]word[[:>:]]'",
          'notlike' => " NOT REGEXP '[[:<:]]word[[:>:]]'"
        );

    Othervise won’t show words like <p>word
      @hawproductions | http://mrhaw.com/

      Infograph: MODX Advanced Install in 7 steps:
      http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

      Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
      http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
      • 21438
      • 10 Posts
      Yes, it now works for 'exactphrase' in version 1.9.2.

      However, I wanted my search to work with 'allwords', but only match full words, so I tried the recommended code hack (above)...

      This seems to work when NO sub-string matches would be returned (eg: a search for 'erefo' will return nothing even though it occurs in 'therefore'). However, if there is *at least one result* for the search term, it will return *all* the sub-string matches (eg: a search for 'the' will return 'therefore', 'bathed', 'catheter' etc as well as 'the').

      I edited line 568 of the ajaxSearchRequest.class.inc.php file - I assume this is what mrhaw meant. I also kinda assumed the following key should be added to the array, as it's referred to a couple of lines later:

      'regexp' => " REGEXP '[[:<:]]word[[:>:]]'"

      Has anyone else found this problem? Any solutions?