We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28100
    • 66 Posts
    How can I exclude the Description field from showing in the results page? eg

    I’ve read the Wiki, tried numerous options but can’t find the magic formula. I also found that image names and/or their alt were being included in search results - how can I remove both?

    Also, I have this character showing up on my search results page (non-ajax) eg ... it only shows if I’ve used " " which I’ve had to use in clearing divs or the div gets stripped out by TinyMCE. Can anyone recommend a fix?
      • 28100
      • 66 Posts
      Fixed! I disabled the Search Highlight plugin, installed the Advanced Search Highlight plugin then changed the template to the following:
      <!--start highlight-->
      			[*#content*]
      <!--end highlight-->


      And all works beautifully! Only the "content" is searched, no "alt" tags get shown in results and no quirkiness with "&nbsp;". smiley


      *jumps for joy*

      ;)
        • 5811
        • 1,717 Posts
        To avoid the search in the description field, use the whereSearch parameter as follow:
        &whereSearch=`content:pagetitle,content|tv:tv_value`
        With this you search only in the pagetitle and content field of documents
        By default the search occurs in all the content fields: ’pagetitle’, ’longtitle’, ’description’, ’alias’, ’introtext’, ’menutitle’, ’content’
        if you are not intrested by a search in tv remove
         |tv:tv_value
        from the parameter

        Also, I have this character showing up on my search results page (non-ajax) eg  ...  it only shows if I've used " "  which I've had to use in clearing divs or the div gets stripped out by TinyMCE.   Can anyone recommend a fix?
        This issue id due to the fact that I do an extract of 200 characters around the search term found and unfortunately, this cut your space &nbsp;. As UTF-8 use 2 bytes per character, I split your space and then you got this weird character (an half character !). The fix is not simple, but I will try to fix for the next release.
          • 5811
          • 1,717 Posts
          To avoid the splitting of the UTF-8 character replace the lines 1170-1171 of classes/search.class.inc.php :
                  $mbStrrpos = 'mb_strrpos';
                }
          by:
                          $mbStrrpos = 'mb_strrpos';
                          mb_internal_encoding("UTF-8");
                      }
          This should avoid the splitting of the two-bytes characters.
          Do the changes, and let me know the results.
            • 28100
            • 66 Posts
            Hi coroico! smiley

            I have 2 installations of modx on 2 different machines with exactly the same site being developed. Both have the same version of modx, AjaxSearch, highlight plugins, snippets/templates etc ... aside from them being on 2 different boxes the only difference is their version of MySQL and PHP.

            One installation (PHP 5.2.10) doesn’t show those weird/split characters ... the other (PHP 5.3.0) does. When I made my last post, I was working on the first installation which oddly, doesn’t doesn’t show those characters.

            For the 2nd installation which does show them, making the edit to the "search.class.inc.php" file didn’t change anything.

            Thanks!
              • 28100
              • 66 Posts
              I’m having Search Result issues ... I’m only wanting to search in the content area but results using a regular search (ajaxSearch=`0`) returns results for the search word in places other than the content (eg menu description etc).

              Using &ajaxSearch=`1` and the results are correct.

              Here’s my call:
              [!AjaxSearch? &ajaxSearch=`0`&highlightResult=`1`&whereSearch=`content:content`&AS_showResults=`0` &AS_landing=`47`!]


              huh

              Edit:
              Just another update to say this only happens on one installation (a Synology NAS) ... so the PHP/MySQL on that box might be inadequate for some functions of MODx. sad