On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Edit - should’ve posted this on the ajaxSearch board.

    I’m receiving the following error when running a search containing a word which is less than 3 chars long:

    "At least 3 characters are required for your search term"

    This is fine you might say, however, I would expect this if I’d searched for something such as:

    "To" or "an" or "ok".

    But I’m getting the error when the search query is a multiple word string containing a word which has less than 3 chars such as:

    "To approve".

    Surely the search function should ignore/filter out words which are less than 3 chars long and carry out the search using the words that are 3 chars and over rather than just spitting it’s dummy out if one of the words isn’t to it’s liking?

    But this doesn’t seem to be the case.
    • To search "To approve", you need to use "exactphrase" with the &advSearch parameter.

      See this demo page for more informations. For instance search "in this" with the exactphrase option ticked.
      • hello Coroico,

        i’ve got a similar problem, on this site : http://tendances-de-voyages.ecotour.com

        trying to search « dîner à oman » answer me that i need at least 3 car.

        so i looked at the code, in ajaxSearchInput.class.inc.php, line 177 ++…
        and if one of the word has less than 3 car. like my example, it won’t works.
        So i just commented lines 180 to 183, and now it works just fine.

        BUT
        another problem occured, exactPhrase doesn’t work too :

        [advSearch] => exactphrase in my config.

        but it still search for each independant word…

        log show this :

        HAVING ((((sc.pagetitle LIKE ’%dîner%’) OR (sc.longtitle LIKE ’%dîner%’) OR (sc.description LIKE ’%dîner%’) OR (sc.alias LIKE ’%dîner%’) OR (sc.introtext LIKE ’%dîner%’) OR (sc.menutitle LIKE ’%dîner%’) OR (sc.content LIKE ’%dîner%’) OR (tv_value LIKE ’%dîner%’)) OR ((sc.pagetitle LIKE ’%dîner%’) OR (sc.longtitle LIKE ’%dîner%’) OR (sc.description LIKE ’%dîner%’) OR (sc.alias LIKE ’%dîner%’) OR (sc.introtext LIKE ’%dîner%’) OR (sc.menutitle LIKE ’%dîner%’) OR (sc.content LIKE ’%dîner%’) OR (tv_value LIKE ’%dîner%’))) OR (((sc.pagetitle LIKE ’%à%’) OR (sc.longtitle LIKE ’%à%’) OR (sc.description LIKE ’%à%’) OR (sc.alias LIKE ’%à%’) OR (sc.introtext LIKE ’%à%’) OR (sc.menutitle LIKE ’%à%’) OR (sc.content LIKE ’%à%’) OR (tv_value LIKE ’%à%’)) OR ((sc.pagetitle LIKE ’%à%’) OR (sc.longtitle LIKE ’%à%’) OR (sc.description LIKE ’%à%’) OR (sc.alias LIKE ’%à%’) OR (sc.introtext LIKE ’%à%’) OR (sc.menutitle LIKE ’%à%’) OR (sc.content LIKE ’%à%’) OR (tv_value LIKE ’%à%’))) OR ((sc.pagetitle LIKE ’%oman%’) OR (sc.longtitle LIKE ’%oman%’) OR (sc.description LIKE ’%oman%’) OR (sc.alias LIKE ’%oman%’) OR (sc.introtext LIKE ’%oman%’) OR (sc.menutitle LIKE ’%oman%’) OR (sc.content LIKE ’%oman%’) OR (tv_value LIKE ’%oman%’)))


        and return me a hundred of results instead of one…
        so my question is, how to search really for an exact phrase ??

        merci d’avance !

          made with MODx => France Douglas || Vintage Weekender

        • On this demo page, the ajaxSearch 1.9.1 version works fine with the exacphrase option. For instance, try to search "in the".

          I think you should upgrade to 1.9.1 wink The following issue has been fixed:

          ==== AJAXSEARCH-72 : Search terms not found with the "exact phrase" option
          http://svn.modxcms.com/jira/browse/AJAXSEARCH-72
          • Sorry but :

            - if i try your demo and search « in the »,
            it answer me « At least 3 characters are required for your search term »
            ( i post a screenshot there : http://tendances-de-voyages.ecotour.com/ajaxsearch/a.png )

            - i updated to 1.9.1 and i don’t have this problem, so this is ok for the min car allowed, thanks.


            My problem is not that the search terms not found,
            My problem is that EACH term is searched, not the EXACTPHRASE,

            example : http://tendances-de-voyages.ecotour.com/

            try searching « corse » => you’ve got ONE answer, the only doc talking about corse, right.

            now, try « dîner à oman » =>it should anwser only ONE doc, just like for « corse », but you’ve got a hundred of doc :

            - all the docs containing only « diner »,
            - all the docs containing only « oman »,
            - and all the docs containing only « à » !!!

            ( you’ve got the logfile in my previous post )





              made with MODx => France Douglas || Vintage Weekender
            • - if i try your demo and search « in the »,
              it answer me « At least 3 characters are required for your search term »
              ( i post a screenshot there : http://tendances-de-voyages.ecotour.com/ajaxsearch/a.png )
              Which is normal, as the "one word" option is selected and "is" has less than 3 characters.

              My problem is not that the search terms not found,
              My problem is that EACH term is searched, not the EXACTPHRASE,

              Which is normal, because on your site the "one word" option is, in fact, used.
              Using the firefox plugin livehttpheaders (https://addons.mozilla.org/fr/firefox/addon/3829/) to check the headers sent by the js script to the php sript, I get this header:
              q=assets%2Fsnippets%2FajaxSearch%2FajaxSearchPopup.php&search=d%C3%AEner%20%C3%A0%20oman&as_version=1.9.1&advsearch=oneword&subsearch=&ucfg=%26highlightResult%3D%600%60%20%26jscript%3D%60mootools2%60%20%26addJscript%3D%600%60%20
              If I search "is the" with "exactphrase" option selected on my demo page, i got only 13 results (which is correct. With "the", I get 19 results) and this http header is sent:
              q=assets%2Fsnippets%2FajaxSearch191%2FajaxSearchPopup.php&search=is%20the&as_version=1.9.1&advsearch=exactphrase&subsearch=&ucfg=%26debug%3D%601%60%20%26parents%3D%6024%60%20%26tplInput%3D%60%40FILE%3Aassets%2Fsnippets%2FajaxSearch191%2Ftemplates%2FinputTemplates%2Finput2.tpl.html%60%20%26asLog%3D%602%3A0%3A200%60%20%26jscript%3D%60mootools2%60%20 

              So Something seems to be wrong with the advSearch parameter on your site. How have you set up the "exactphrase" option ?

              In the debug file, you should find a code line like this:
              [7-Oct-10 02:37:18]  0.0518s  2.81Mb > getSearchString - advSearch : exactphrase
              is it the case ?


              • I do a test with the following AS snippet call:
                [!AjaxSearch[*asversion*]? &advSearch=`exactphrase` &jscript=`mootools2` &parents=`24`!]
                And I confirm that the advSearch value is overwritted by the default value "one word".
                So when the &ajaxSearch comes thru a form it is ok but not when the values is passed thru the snippet call.
                • i set it in $default = AS_PATH . ’configs/default.config.php’;
                  => $dcfg[’advSearch’] = ’exactphrase’;

                  but the log still say ’oneword’…

                  =>
                  [7-Oct-10 08:20:58] 0.0092s 4.21Mb > getSearchString - searchString : dîner à oman
                  [7-Oct-10 08:20:58] 0.0092s 4.21Mb > getSearchString - advSearch : oneword

                  in the snippet code, i’ve got this
                  =>
                  $cfg[’advSearch’] = isset($advSearch) ? $advSearch : (isset($__advSearch) ? $__advSearch : $dcfg[’advSearch’]);

                  i’m going to try to change the value in the snippet call…
                  but i don’t understand why the default config file doesn’t work

                    made with MODx => France Douglas || Vintage Weekender
                  • With the non-ajax mode (&ajaxSearch=`0`)when &advSearch=`exactphrase` is used in the snippet call, the search runs correctly. Not with the ajax mode (&ajaxSearch=`1`)

                    i’m going to try to change the value in the snippet call…
                    but i don’t understand why the default config file doesn’t work
                    Because this is a bug!
                    • aaaaarrrrgggg !!!

                      so i’m épluching you’re code and trying to find a way to force ’exactphrase’ !!

                      and thank you for the http headre tip.
                        made with MODx => France Douglas || Vintage Weekender