We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21800
    • 174 Posts
    was so lucky with modX 0.9.5

    updated to it from .2, run ajaxSearch then realized that it doesn’t find Umlaute like ä,ö, ...

    the search within the manager behaves different, it finds some, not all (also different searching in title, logtitle etc.).

    v0.9.5 came with utf-8 default, v0.9.2, I remember with ISO-8859-1

    changed the main templates to utf-8 (like ajaxSearch), resaved some pages -- no solution

    how can I get out of this?
      • 7923
      • 4,213 Posts
      The RTE changes ä,ö, etc to html entities, so they will be &auml and &ouml in the database for the document content field. The page title, long title, etc fields does not do that conversion. So when you search using some search snippet, it finds the documents that have ä or ö in page title field but not the ones that have those letters in document content field.

      You would need to modify the search snippet do a search for both, html entities version of the keyword and without html entities conversion.


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 21800
        • 174 Posts
        I presumed that.

        but how to do that, can’ imagine that I’m the only one with that problem.

        annother thing is: title and longtitle are shown as html entities (ä) in source text, but in some cases found in longtitle with ä but not in title (manager search) - it’s confusing for me.

        Do you also mean, that I should let main setting to be utf-8? and German (as you may have guessed)

        you know it is a bad feeling when you can`t rely on search results.
          • 7923
          • 4,213 Posts
          Yes, you are not the only one with this problem.. there has been similar threads before.. I don’t know why you sometimes see ä and sometimes &auml.. if they are the same record from database, that seems weird.. I guess some of the manager pages does the html entities conversion by them self and some just display whatever is in the database..

          But the modifications to the search snippet would be to modify the sql sentence to search for $keywords and htmlentities($keywords) at the same time. Or have the charset with the conversion call too htmlentities($keywords, ENT_QUOTES, ’UTF-8’);


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 19741
            • 90 Posts
            Quote from: doze at Jan 19, 2007, 12:58 PM

            But the modifications to the search snippet would be to modify the sql sentence to search for $keywords and htmlentities($keywords) at the same time.
            @doze: Thanks for this answer - now the search on my site is running with "umlaute", too.
              Bye,
              Mithrandir
              • 21800
              • 174 Posts
              seems to be a good news,

              but could someone explain what to do in detail? (or is there an enhanced script?)
              Does the solution concern the flexSearch snippet or/and the ajaxSearch (I guess the "manager search" depends on flexSearch?)
                • 19741
                • 90 Posts
                At First: Please excuse my bad english (here is a "german user writing"):

                I don’t use AjaxSearch and so i changed the snippet "MollioFlexSearchForm". Look for this code:

                Here’s the original code:
                        foreach ($search as $searchTerm){
                          $sql .= "MATCH (pagetitle, description, content) AGAINST ('$searchTerm') AND ";
                        }
                      } else {
                        $sql .= "MATCH (pagetitle, description, content) AGAINST ('$searchString') AND ";
                      }
                      $sql .= "$tbl.published = 1 AND $tbl.searchable=1 AND $tbl.deleted=0;";
                    }


                Here the changed code:
                        foreach ($search as $searchTerm){
                          // Aenderung, um Umlaute abzufragen!
                          $strUml=htmlentities($searchTerm);
                          $sql .= "(MATCH (pagetitle, description, content) AGAINST ('$searchTerm') OR MATCH (pagetitle, description, content) AGAINST ('$strUml')) AND ";
                        }
                      } else {
                        // Aenderung, um Umlaute abzufragen!
                        $strUml=htmlentities($searchString);
                        $sql .= "(MATCH (pagetitle, description, content) AGAINST ('$searchString') OR MATCH (pagetitle, description, content) AGAINST ('$strUml')) AND ";
                      }
                      $sql .= "$tbl.published = 1 AND $tbl.searchable=1 AND $tbl.deleted=0;";
                    }


                I think the AjaxSearch must be changed in a similar way, but there you have to look in assets\snippets\AjaxSearch\AjaxSearch.inc.php.
                  Bye,
                  Mithrandir
                  • 21800
                  • 174 Posts
                  thanx for that tip, but I can’t see through that code in AjaxSearch.inc.php. I tried some possibilities with no success.
                  I wonder if there is a stable and relieable srcipt already existing getting around with this special chars

                  perhaps this fit it? http://modxcms.com/forums/index.php?PHPSESSID=c3776bb1759e4a0327b837e74c13bbb3&topic=3501.msg29032
                  (but it is older than 0.9.5)

                  ???
                    • 7923
                    • 4,213 Posts
                    For ajaxsearch, you’ll have to modify the AjaxSearch.inc.php and it’s doSearch function.


                      "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                      • 21800
                      • 174 Posts
                      I tried this and that, but (sorry) the tip was not really helpfull for a semi php sKilled author