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
    @Akots
    1. For the coding UTF8 at discrepancy of the register of letters highlighting does not work. It is connected to features of functions preg - it is necessary to add a key "u". In the file search.class.inc.php correction:
    $finalExtract = preg_replace( ’/’ . preg_quote( $searchTerm, ’/’ ) . ’/iu’, …
    and in the plugin searchHighlight:
    $pattern = ’/’ . preg_quote($word, ’/’) . ’(?=[^>]*<)/iu’;
    I know this update done by yourselft for the Russian language. I haven’t integrated this update because it doesn’t run on my environment with english or french langauge in UTF8.


    2. At use html entitys a scrap of a required fragment can give out only a part, for example &quo or something similar. For correction in the file search.class.inc.php at the beginning of function getExtract it is necessary to add something like:
    $text=html_entity_decode($text, ENT_QUOTES, "UTF-8");
    and at the end of function to correct a command approximately so:
    $finalExtract .= $extracts[$i][’etcLeft’] . htmlentities($mbSubstr($text,$extracts[$i][’left’],$extracts[$i][’right’] - $extracts[$i][’left’]+1), ENT_QUOTES, "UTF-8") …
    As we use, urlencode, htmlentities is not required and generate lot of issue. About that look at this post:
    http://modxcms.com/forums/index.php/topic,5357.msg154012.html#msg154012

    On http://www.modx.wangba.fr/index.php?id=144 choose the french documents (accented language) And run the following tests:

    1/ try "d’enfants"
    2/ try "3,9%"
    3/ try "UNESCO/Eduardo"

    The limitation is "&test". Try it, you don’t find any text ... this due to tinyMCE which store & as &amp;
    Try "&amp;test" and you got the result grin

    May be to bypass this issue, it could be interesting, to use the stripInput function to replace on fly & by &amp;
    I am not sure to be able do more
      • 5811
      • 1,717 Posts
      @rossco
      Which highlight plugin do you use. If you use the new advSearchHighlight plugin, you need to frame the area of text you want highlight by <!--start highlight--> and end it by <!--end highlight-->

      If you use the classical searchHighlight plugin, nothing as change, except that now it takes into account of the &advSearch parameter.
        • 25551 ☆ A M B ☆
        • 1,231 Posts
        I did try the advanced one first and I put only the <!--start highlight-->, i assumed it was the same idea as the original one.

        Would i put <!--start highlight--> say at the beginning of my <div> then <!--end highlight--> just before the </div>?

        Quote from: coroico at Jun 23, 2008, 10:21 AM

        @rossco
        Which highlight plugin do you use. If you use the new advSearchHighlight plugin, you need to frame the area of text you want highlight by <!--start highlight--> and end it by <!--end highlight-->

        If you use the classical searchHighlight plugin, nothing as change, except that now it takes into account of the &advSearch parameter.
          Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
          AugmentBLU - MODX Partner

          BLUcart - MODX Revolution E-Commerce & Shopping Cart
          • 5811
          • 1,717 Posts
          i assumed it was the same idea as the original one.
          No, with the classical plugin, you couldn’t frame the part you would like highlight and you cant’ have many areas in the same document. Only one : <body> </body> sad and keep care do not add any id like
          <body id="type-a"> otherwise, it does’nt run it.

          I have updated and keep the classical plugin for compatibility.
            • 25551 ☆ A M B ☆
            • 1,231 Posts
            I’m not sure I understand what you mean by frame? I created a border using style to "frame" my highlighted words... style="border: 1px dashed #666666; color:red" for example. I’m not sure if that is what you mean? Sorry for my ignorance!

            Ross

            Quote from: coroico at Jun 23, 2008, 10:45 AM

            i assumed it was the same idea as the original one.
            No, with the classical plugin, you couldn’t frame the part you would like highlight and you cant’ have many areas in the same document. Only one : <body> </body> sad and keep care do not add any id like
            <body id="type-a"> otherwise, it does’nt run it.

            I have updated and keep the classical plugin for compatibility.
              Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
              AugmentBLU - MODX Partner

              BLUcart - MODX Revolution E-Commerce & Shopping Cart
              • 785
              • 2,113 Posts
              Quote from: coroico at Jun 23, 2008, 10:15 AM

              On http://www.modx.wangba.fr/index.php?id=144 choose the french documents (accented language) And run the following tests:
              Select "Exact phrase" and search ", 58" – result: " ...amp;test for MODx". I wrote about it. It seems to me what better to correct it.
                Создание сайтов на MODx, поддержка сайтов, поисковая оптимизация, программирование, копирайтинг
                Статьи о MODx, регулярно новые публикации
                • 5811
                • 1,717 Posts
                Akots,

                When I choose French documents and I select "Exact phrase" and search ", 58", I get a result (image attached).

                But you are right if the "&amp;" is cut (because at the beginning of extract) we get : " ...amp;test for MODx". It is also true when you split a "two character" utf8. In the extract algorithm, I search the beginning (/end) of the word but something is probably wrong. Any suggestion to improve this is welcome.
                  • 5811
                  • 1,717 Posts
                  Rossco, by frame I mean enclose the part of your template you want with the "start" and the "end" tags. Like this :
                  <body id="type-a">
                    <div id="header">
                      <div id="logo">
                        <h1>AjaxSearch</h1>
                      </div>
                      [!Wayfinder? &startId=`50` &level=`2` &outerTpl=`wfOuter`  &innerTpl=`wfInner` &rowTpl=`wfRow` &hereClass=`active` &firstClass=`first` &lastClass=`last` &titleOfLinks=`description`!]
                    </div>
                  <!--start highlight-->
                    <div id="content">
                      <div id="colOne">
                      [*content*]
                      </div>
                    </div>
                  <!--end highlight-->
                  <div id="footer">
                    {{ajaxSearchFooterEN}}
                  </div>
                  </body>
                  Here I limit the highlighting to the text of the document. Items of Menu are never highlighted with that.
                    • 785
                    • 2,113 Posts
                    Quote from: coroico at Jun 23, 2008, 12:24 PM

                    Any suggestion to improve this is welcome.
                    I wrote, that if to put in the beginning of function getExtract:

                    $text=html_entity_decode($text, ENT_QUOTES, "UTF-8");
                    or (for non UTF-8):
                    $text=html_entity_decode($text, ENT_QUOTES);

                    result will be correct

                    And I think: "two character" utf8 is cut when using substr instead of mb_substr or not set "mb_internal_encoding("UTF-8");".
                      Создание сайтов на MODx, поддержка сайтов, поисковая оптимизация, программирование, копирайтинг
                      Статьи о MODx, регулярно новые публикации
                      • 785
                      • 2,113 Posts
                      Quote from: coroico at Jun 23, 2008, 10:15 AM

                      I know this update done by yourselft for the Russian language. I haven’t integrated this update because it doesn’t run on my environment with english or french langauge in UTF8.

                      Strange - in the PHP manual it is written, that it is necessary to use this modifier - "Pattern strings are treated as UTF-8".
                        Создание сайтов на MODx, поддержка сайтов, поисковая оптимизация, программирование, копирайтинг
                        Статьи о MODx, регулярно новые публикации