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
    Find enclosed the release 1.8.2 of AjaxSearch

    Thanks for your feedbacks before an upload of this new release into the MODx repository.
    Don’t hesitate if you have any remarks or suggestions regarding the software or the documentation.
    This new version runs on the AjaxSearch demo site here.

    I need some new translations for this new release. Look at this topic for more informations.

    Remaining tasks:
    As discussed here, i will try (but not sure) to improve the liveSearch feature before a definitive delivery.


    ============================== NEW OPTIONS / CHANGES ===========================

    ==== LiveSearch

    - ajaxSearchType parameter replaced by liveSearch. e.g: &liveSearch=`1`
    Now the search starts only when the minimum character is reached


    ==== Initialisation of configuration parameters change

    To limit the number of javascript variables, now the default parameters are stored in the default.config.inc.php file. This file is read by the ajaxSearch class and by the ajaxSearchPopup class. The only parameters transmitted by JavaScript to the ajaxSearchPopup class are:
    - the subSearch and the advSearch parameters
    - the parameters used in the snippet call


    ==== Mootools (1.11 or 1.2.1) or Jquery js library - AJAXSEARCH-2

    &jscript [’jquery’ | ’mootools1.2’ | ’mootools’]
    Set this to jquery if you would like to include the jquery library
    set this to mootools1.2 to include the mootools 1.2.1 library (limited to JS functions used by AS)
    by default: mootools. This default include the mootools library provided by MODx

    e.g: &jscript=`jquery` or &jscript=`mootools1.2`


    ==== Capturing failed search criteria and search logs - AJAXSEARCH-3

    &asLog - ajaxSearch log [ level [: comment]]

    level:
    0 : disallow the ajaxSearch log (default)
    1 : failed search requests are logged
    2 : all ajaxSearch requests are logged
    comment:
    0 : user comment not allowed (default)
    1 : user comment allowed

    &asLog=`1` is equivalent to &asLog=`1:0`


    &tplComment : chunk to style comment form
    by default: @FILE:".AS_SPATH.’templates/comment.tpl.html’

    The comment form is protected from spamming by the use of a hidden input field. (idea suggested from SPForm by Bob Ray ) This field should be hidden by the CSS styling. If it’s filled in (presumably by spammer autobots) nothing is sent. The "hidden" content is not really hidden, just not visible, so no worries about being penalized by Google. Visually challenged users of text-only browsers or audio browsers MAY see the input field and fill it (although the text warns them not to).

    You need to paste the following code into your CSS file. Otherwise the field will not be hidden.

    .ajaxSearch_hiddenField {
    position:absolute;
    text-decoration:underline;
    background-color:#CC0000;
    left:0px;
    top:-500px;
    width:1px;
    height:1px;
    overflow:hidden;
    }

    Keep spammers from pasting too many links into the comment and sending it (counts "http" instances); A maximum of 2 links per comment is allowed otherwise the comment is rejected.
    You could adjust this value in the file classes/ajaxSearchLog.class.inc by changing the CMT_MAX_LINKS definition.

    The maximum length of the comment is of 100 characters. Otherwise the comment is rejected. Helps short-circuit injection attacks.
    You could this value in the file classes/ajaxSearchLog.class.inc by changing the CMT_MAX_LENGTH definition.

    The user searches are stored in the database table $modx_table_prefix."ajaxsearch_log"
    These data are not for the end user only for the site administrator.

    Informations stored per each search are the following:

    - id : internal id of the search request looged
    - searchstring : the search terms used for the search
    - nb_results : number of results found
    - results : document ids found
    - comment : comment leave by the user regarding the search results
    - as_call : ajaxSearch snippet call used
    - as_select : select statement used (could be reused thru phpmyadmin)
    - date : date and hour of the request
    - ip : user IP

    The table could be drop without any impacts on the AjaxSearch behaviour. Simply, if the asLog parameter is set and the table inexisting, the table is rebuilt.

    A ’Did you find what you are looking for?’ form is available for the user when the option comment is set. In this case the user could leave a comment about the search results.
    &tplComment parameter define which form template used.

    A module will be provided later (any help for the development of this module is welcome) to manage these search datas.
    We could imagine the following features:
    - drop the table
    - delete (successfull, unsuccessfull, all) searches executed before a specific date
    - delete (successfull, unsuccessfull, all) searches executed before N days
    - give me as meta tag keywords, the N most used (successfull, unsuccessfull) search terms
    - replay a specific search with a new debug level
    - delete uncommented (successfull, unsuccessfull, all) searches
    - filter view with commented (successfull, unsuccessfull, all) searches

    See the Log search requests demo and the AjaxSearch 1.8.2 log on the demo site


    ==== Limit the amount of keywords that will be queried by a search - AJAXSEARCH-9

    &maxWords [int]
    Maximum number of words for searching - Default: 5


    ==== php_mbstring extension

    &mbstring [0 | 1]
    1 - mbstring extension available (default)
    0 - don’t use php_mbstring extension

    The php_mbstring is supposed to be loaded.
    If html charset page is "UTF-8", php_mbstring extension should be loaded for language which need a multi-byte representation.
    If the extension is not available for the PHP server, some charset like ISO-8859-1 (latin1) could be used.
    With UTF-8, a message "Php_mbstring extension is required" when &mbstring=`1` and the extension not loaded.
    In this case load the extension or set the mbstring parameter to 0 if you couldn’t load the extension


    ==== FirePhp extension library updated

    Update of FirePhp lib directory from 0.2.b.2 to 0.2.1 version
    See classes/FirePHPCore


    ================================ ISSUES CORRECTED ==============================

    ==== AJAXSEARCH-12 : Take into account of the &advSearch parameter when the &minChars is checked
    http://svn.modxcms.com/jira/browse/AJAXSEARCH-12

    AJAXSEARCH-13 : Wrong Highlighting of search terms
    http://svn.modxcms.com/jira/browse/AJAXSEARCH-13

    ==== AJAXSEARCH-15 : use $modx->getFullTableName(’’)
    http://svn.modxcms.com/jira/browse/AJAXSEARCH-15

    ==== AJAXSEARCH-17 : Livesearch - start of the search only when the minimum character is reached
    http://svn.modxcms.com/jira/browse/AJAXSEARCH-17

    ==== AJAXSEARCH-18 : function stripHtml incorrectly works
    http://svn.modxcms.com/jira/browse/AJAXSEARCH-18

    ==== AJAXSEARCH-19 : Parse error if the user enters two or more spaces between words in the query
    http://svn.modxcms.com/jira/browse/AJAXSEARCH-19

    ==== AJAXSEARCH-21 : search for something like "ecuador span"
    http://svn.modxcms.com/jira/browse/AJAXSEARCH-21

    ==== AJAXSEARCH-22 : you get a TV value with tvPHX, only if the search has found your term in the TV
    http://svn.modxcms.com/jira/browse/AJAXSEARCH-22

    ==== AJAXSEARCH-24 : AjaxSearch stops searching through TV content after a certain number of characters
    http://svn.modxcms.com/jira/browse/AJAXSEARCH-24

    ==== AJAXSEARCH-25 : Security issue with AS_offset
    http://svn.modxcms.com/jira/browse/AJAXSEARCH-25

    ==== AJAXSEARCH-26 : If the offset exceeds the number of documents retrieved, modx crashes
    http://svn.modxcms.com/jira/browse/AJAXSEARCH-26

    [EDIT: Attached file removed]
      • 5811
      • 1,717 Posts
      Some of you may be have got this error message:
      Call to a member function dbgLog() on a non-object in E:\Perso\www\wangba0961\assets\snippets\ajaxSearch\classes\ajaxSearchPopup.class.inc.php on line 128
      Apologize for this issue, this is only a trace for debug that I forgot to remove.
      To correct this issue simply remove the line #128 of classes/ajaxSearchPopup.class.inc.php :
      $this->asDebug->dbgLog($this->cfg,"AjaxSearchPopup - cfg");
        • 31178
        • 128 Posts
        Just querying if you intend to include the AJAXSEARCH-27 patch in the next release you issued here: http://modxcms.com/forums/index.php/topic,33618.msg205211.html#msg205211
        Thanks!
          • 5811
          • 1,717 Posts
          Yes. wink The fix of the issue #27 is already included in the current release 1.8.2 which runs on the demo site.
            • 31178
            • 128 Posts
            ah yes I had missed the reference to #27 on your site! I just saw it was not on this thread, but that would have been posted before you came up with the fix embarrassed
              • 27843
              • 170 Posts
              Hi all,

              i lack css class-es for some elements in the paging.tpl.html temaplte for paging.

              Now the output looks like this: sad
              <span class="ajaxSearch_paging"><br />    Result pages: 1 | <br />    <a href="/cs/vysledky-hledani?AS_offset=10&amp;AS_search=emerson&amp;advsearch=oneword">2</a><br /></span>

              I suggest something like this: wink
              <span class="ajaxSearch_paging"><br />    <span class="ajaxSearch_pagingIntroMsg">Result pages: </span><br />    <span class="ajaxSearch_currentPage">1</span> | <br />    <a href="/cs/vysledky-hledani?AS_offset=10&amp;AS_search=emerson&amp;advsearch=oneword">2</a><br /></span>


              If you agree, pls adjust css class names and i can create patch for that. I think that this little modification is good choice.
                • 25663 MODX Staff
                • 12,272 Posts
                I personally would cut out the first wrapper span around the "Result pages: " text as it’s not needed. You could style everything idividually with the following UNLESS you needed different control over the pipe-character:

                .ajaxSearch_paging { rules for "Result pages: and the pipe here }
                .ajaxSearch _current { current page style }
                .ajaxSearch a { other pages/link styles }
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 5811
                  • 1,717 Posts
                  ShowPagingAlaways parameter implemented with AS 1.8.2.
                  See this demo page. Try "the" as search term.

                  I have updated the paging template by the addition of the ajaxSearch_currentPage class:
                  <span class="ajaxSearch_paging">
                  Result pages: <span class="ajaxSearch_currentPage">1</span> : 
                  <a href="/index.php?id=259&AS_offset=5&AS_search=the&advsearch=oneword">2</a> : 
                  <a href="/index.php?id=259&AS_offset=10&AS_search=the&advsearch=oneword">3</a>
                  </span>


                  [+as.tpl:is=`paging`:then=`
                    <span class="ajaxSearch_paging">
                      [+as.pagingText+]
                      [+as.pagingLinks+]
                    </span>
                  `+]
                  [+as.tpl:is=`pagingLinks`:then=`
                    <a href="[+as.pagingLink+]">[+as.pagingText+]</a>[+as.pagingSeparator+]
                  `+]
                  [+as.tpl:is=`pagingLinksCurrent`:then=`
                    <span class="ajaxSearch_currentPage">[+as.pagingText+]</span>[+as.pagingSeparator+]
                  `+]

                    • 27843
                    • 170 Posts
                    Quote from: coroico at Mar 16, 2009, 07:03 PM

                    ShowPagingAlaways parameter implemented with AS 1.8.2.
                    See this demo page. Try "the" as search term.

                    Hi coroico,

                    ok, that is good, thank you