public List<Location> searchLocations(final String phrase) {
        final String like = phrase.replaceAll("(\\s)", "%$1") + "%";
        final List<Location> result = getLocations(
                "replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(\n" +
                        "replace(lower(name),'.',' '),\n" +
                        "'á','a'),\n" +
                        "'é','e'),\n" +
                        "'í','i'),\n" +
                        "'ĺ','l'),\n" +
                        "'ó','o'),\n" +
                        "'ŕ','r'),\n" +
                        "'ú','u'),\n" +
                        "'ý','y'),\n" +
                        "'č','c'),\n" +
                        "'ď','s'),\n" +
                        "'ľ','l'),\n" +
                        "'ň','n'),\n" +
                        "'š','s'),\n" +
                        "'ť','t'),\n" +
                        "'ž','z'),\n" +
                        "'ä','a'),\n" +
                        "'ô','o') LIKE lower(?)\n" +
                        "ORDER BY CASE country_code WHEN 'SK' THEN 0 ELSE 1 END, length(name), name", like);
        return result;
    }

Author: I am satisfied with the project and I don't think I have anything to be ashamed of

By Anonymous, 2020-07-16 10:49:27