We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5811
    • 1,717 Posts
    How would you like style your search results ?

    What is your snippet call on the landing page ? It seems that you don’t use the default extractEllips and extract parameters values.

    May be it could be interesting to keep the default value of the ellipsis parameter (&extractEllips ) (...). IMHO, i think it is useful for the user to understand that the displayed text is an extract.
    You could also limit the number of extract by using the default parameter extract (aextract). So you get only one extract per document rather to get all the possible extracts.
      • 24735
      • 33 Posts
      well I am trying to get it too look like

      Link| Grey description
      break
      ... Extract description with highlighted keywords...

      LINE BREAK---------------------


      I got it to display the search result links in a way that would make it obvious for people that the link is the beginning of a search results (thanks to your tips)

      I still cant figure out how to only get one paragraph of the extract. Not sure where to set that.. i see a few possible places.. but so far had no luck (i am looking in the snippet file itself through modx snippet manager)

      Also I am changing the ellipsis to ... you make a very good point the way I structured it did not work with the " marks some words got clipped so the Quote would start with a wierd random word.

      I am not to sure where to plug in the aextract part I plugged it in to

      // &extractLength [int]
      // Length of extract around the search words found - between 50 and 800 characters
      $cfg[’extractLength’] = isset($extractLength) ? intval($extractLength) : (isset($__extractLength) ? intval($__extractLength) : 50); <-- aextract

      that didnt seem to work though? somehow i feel that was the wrong place to plug it in to.

      By the end of today I see a nice bright light at the end of my ajaxsearch tunnel. laugh

        • 24735
        • 33 Posts


        the progress so far.. now I just need to get rid of the other extracts and add some more to the extract characters option to make the line look like a paragraph.
          • 5811
          • 1,717 Posts
          // &extractLength [int]
          // Length of extract around the search words found - between 50 and 800 characters
          $cfg[’extractLength’] = isset($extractLength) ? intval($extractLength) : (isset($__extractLength) ? intval($__extractLength) : 50); <-- aextract

          Redwolf, in any case you need to change the default value in the snippet template. It’s better to use the parameters.

          Could you give me your snippet calls ? The first one where the input search appears and the second one on the landing page.
          Without these snippet calls I can’t really help you.
            • 24735
            • 33 Posts
            [!AjaxSearch? &ajaxSearch=`0` &AS_landing=`34`!] <---- input search paramater

            [!AjaxSearch? &ajaxSearch=`0` &extract=`99` &AS_showForm=`0`!] <--- the search result page parameter

            "It’s better to use the parameters." soo.. i shouldnt be changing stuff in the snippet file ? Where would I find the parameters section tab? (sorry Newb here)

            Thanks!
              • 5811
              • 1,717 Posts
              The minimal call on the landing page could be
              [!AjaxSearch? &ajaxSearch=`0` &AS_showForm=`0`!]
              In this case by default:
              - the extractEllips parameter is set to ’...’ so, you don’t need to specify a new one.
              - the extract parameter is set to ’1:content,description,introtext,tv_content’

              If you write
              [!AjaxSearch? &ajaxSearch=`0` &extract=`99` &AS_showForm=`0`!] 
              you accept a maximum of 99 extract with search terms found in all the fields !
              So may be, it could be better to use for instance:

              [!AjaxSearch? &ajaxSearch=`0` &extract=`1:content` &AS_showForm=`0`!] 
              In this case, you display only the first result with the content field (if it contains the search term, otherwise an empty string).

              After that, look the code and adapt the css tags used to display the results.
                • 24735
                • 33 Posts
                This is great! grin

                I finally got it to look the way I want.

                And I think I am finally grasping the concept of how to work with ajaxsearch snippet.
                Thanks! Coroico for the help, and the lesson.