We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10405
    • 288 Posts
    Hi, having set up AjaxSearch I’ve noticed that by default when you do a search it brings up results where it matches the names of pages to your query- so if I search for "x" it brings up pages with "x" in their name.

    What I’d like it to do is search through the text content of all the pages and come up with results on that basis, so if any page contains that search term, it gets included in the results. If the individual word or phrase results could also be highlighted somehow that would be even better.

    Also, and this may be pushing it, I wonder if it can be set up to calculate "percentage relevance" for each page- for example if a particular page contains more instances of the search term than any others, it comes at the top of the search results, with the highest percentage relevance marked next to it.

    Does anyone know if and how these things can be achieved?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      AjaxSearch does search the content field.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 10405
        • 288 Posts
        Not on my installation I’m afraid. For example if I search on "travel", a word which I know comes up a lot on some pages, I get:

        2 results found for "travel".

        Travel Travel page
        ...Travel page ...

        Travel Features Travel Features page
        ...Travel Features page ...

        - and that’s it.

        The code I’m using is:

        [!AjaxSearch? &ajaxSearch=`0` &AS_landing=`70`&AS_showResults=`0`!]
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          All I can say is that it’s always worked just fine for all the sites I’ve used it on. Do you have a link for this site?
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 10405
            • 288 Posts
            Have a look at http://78.136.31.10/index.php

            Use the search box under the big phone number at the top.



              • 28042 ☆ A M B ☆
              • 24,524 Posts
              That is odd; I’ve never seen it do that before. Is this the AjaxSearch that was installed with MODx by default? What version of MODx and of AjaxSearch?
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 10405
                • 288 Posts
                The AjaxSearch version is 1.8.3, I’m running the version 1.0.0 of modX...

                Thanks
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  What does your AjaxSearch snippet on the landing page look like?
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 10405
                    • 288 Posts
                    [!AjaxSearch? &ajaxSearch=`0` &AS_showForm=`0` &tplResults=`{{resultsholder}}` &tplResult=`{{resultholder}}` !]

                    The {{resultholder}} and {{resultholders}} chunks are just empty chunks to hold the results (suggested in another thread)





                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      Hm. Still works fine for me (I installed a brand-new 1.0 just to test this out). Do you have any plugins besides the Search Highlighting one that might affect search results?
                        Studying MODX in the desert - http://sottwell.com
                        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                        Join the Slack Community - http://modx.org