We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17883
    • 1,039 Posts
    Hi,

    I just modificated the FlexSearchForm a bit and think perhaps someone is interested in it wink My problem was that I built a site and didn´t fill out the description of the pages and so the search results are not that informative (as the results on the modxcms page). That was the first time I found something that joomla does better, so I transferred that functionality to modX.

    What it does: With displaying search results you´ll get an extract of the context with highlighted search term. Also multiple words are possible and are highlighted the google way wink

    See example here:

    www.mademyday.de/ifa

    Search for example for "familie" (german site), you will see what it does.

    In the snippet you can configure the variable $extract to either true or false, which will (surprise!) show the extract or not. There are two CSS classes used, FSF_extract for the div container with the extract and a span class called FSF_highlight for highlighting the text in this extract (yellow background in the example above)

    This is not the standard FSF, I translated some words and changed a few settings, but I think you guys will get it (no time to put in the standard FSF yet).

    Greetz Marc

    EDIT: New version with different colors for every phrase (FSF_highlight1, FSF_highlight2 etc.)
      • 25663 MODX Staff
      • 12,272 Posts
      OK so that absuletly rocks. We will most likely add this to the default core distribution... thanks!

      Any way to have it use an array of color definitions when putting in multi-item searches, like searching for "familie durch Doppel".
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 17883
        • 1,039 Posts
        OK so that absuletly rocks. We will most likely add this to the default core distribution... thanks!

        You´re welcome, glad to give a little bit back to you guys wink


        Any way to have it use an array of color definitions when putting in multi-item searches, like searching for "familie durch Doppel".

        Don´t understand now, do you mean seperate definitions for the terms? E.g. "familie" in yellow, "doppel" in blue and so on? I´ll try wink

        Greetz Marc
          • 25663 MODX Staff
          • 12,272 Posts
          exactly mark...it’s the way that Google does it I think for cached page views:

          http://64.233.179.104/search?q=cache:qEqwrLh01bkJ:www.angelfire.com/gundam/simplykat/blog/+one+two+threee&hl=en&gl=us&ct=clnk&cd=1&client=safari
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 17883
            • 1,039 Posts
            No problem I think. What do you think is better: To highlight like <span class="FSF_highlight1">one</span> some text <span class="highlight2">two</span>bla bla text... or to define the colors in an array in the snippet itself? I would prefer to define highlight1-x in the CSS. (I already did that local, just have to highlight the search header like googel wink ).

            Greetz Marc laugh
              • 19986
              • 90 Posts
              Thanks Marc, that’s great, just what I was looking for.

              For anyone who wants English, here it is with all config back to the modx defaults.

              Steph
                • 4095
                • 372 Posts
                Awesome, can’t wait to get back from my few days away on courses and implement it.

                Had trouble with the original highlight option (think it was Sottwells) so be cool to bust this one out and have a go wink
                  [img]http://www.emanz.ac.nz/assets/images/logo/emanz-icon_16x16.gif[/img] Emergency Management Academy of New Zealand [br] http://www.emanz.ac.nz[br][br]MODx Sandbox Login: sandbox Password: castle [br]
                  Admin Sandbox Login: sandbox Password: castle
                  • 17883
                  • 1,039 Posts
                  Okay, here we go:

                  www.mademyday.de/ifa

                  Try with Ryan´s funny search "familie doppel durch" (means family double through laugh ).

                  Changed the attachement from the first post.

                  @Steph: Would you be so kind to translate/set it back to standard, have to finish this site this night (we have 1 o´clock here) :-/

                  Greetz Marc

                  PS: I´m not a coder, this could surely be more properly, so if anyone likes to improve it... go on wink
                    • 25663 MODX Staff
                    • 12,272 Posts
                    Nice work! You going to update the source and share for everyone here?
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 17883
                      • 1,039 Posts

                      Changed the attachement from the first post.

                      EDIT: New version with different colors for every phrase (FSF_highlight1, FSF_highlight2 etc.)


                      ;)