Enhancement: Location search
The location search interaction does not seem to be optimal yet. If I pass to existing and complete location, everything is OK (nice icons btw. ;-)). I currently use the syntax pattern
However...
In case where I entered the
Also in the case I have entered
Again, if there are missing feature in libosmscout for this, or if there are performance problems on "the other side", plese make issues there.
Currently the client-qt exposes only search by pattern. Should be improved ... I will make a review
@Framstag , having a look on search, I found a major issue in core functions:
UTF8StringToUpper, UTF8StringToLower.
Those functions use locale settings to initialize facet, but IMO unicode strings shouldn't handle within this way. For now only the locale code page can be processed right. So if the env is C you cannot handle latin, cyrilic or any other page. That is opposite to the unicode concept. The side effect is you cannot match properly the search string, as resulting you take many others matched objects with a failed convert (char code ?). I am looking for a resolution, first we can use libicu but that add a new dependency. So second I am coding a table to convert lower/upper properly for unicode strings.
You are right, these functions doesn't work with C locale. But it is correct, because for converting unicode characters to lower or upper, you really need to know locale. It is locale dependent.
You should setup global C++ locale somewhere in your application, before start using these functions
try {
std::locale::global(std::locale(""));
} catch (const std::runtime_error& e) {
std::cerr << "Cannot set locale: \"" << e.what() << "\"" << std::endl;
}
@Karry, right, but some platforms have only C with character set utf8. As example you are english user and you need to search a location in Germany. In this case you will never succeed to find what you wish. The transliterate is applied on the upper transformation which fails.
Edit: Transliterate is ok because we are using iconv. But the upper function breaks the strings.
Note also that at least LocationService uses a StringMatcherFactoryRef for comparison, which allows to inject another implementation.
Which code is the problem and does it use above matcher?
Background: I have an aversion regarding big library build and runtime dependencies ;-) Especially ICU is a monster. By injecting your own implementation (which might use ICU) you could be able to fix this?
Note that using MSYS you do not even get a proper C++ locale at all. A reason why some tests are disabled there.
@Framstag, me too I have an aversion regarding dependencies. So I am making the code to convert properly an unicode string to upper or lower. Big work to build the table for pages code but it works. I am near the target ... ;-). The code is simple and very fast, because I take the character from the array of the page code.
A sample with GREC character with C locale or any other locale:
Ρίξτε μια ματιά εφησυχασμού, Ω ισχυρή γυναίκα, άγια, βασίλισσα, Για τη θανατηφόρα ανεπάρκεια μου Χωρίς αμφιβολία να σας κάνει γαλήνιο: Πάντα λυπημένος από τον μαραμένο χρόνο, Τουλάχιστον, χαμόγελο στον καταραμένο γέρο.
ΡΊΞΤΕ ΜΙΑ ΜΑΤΙΆ ΕΦΗΣΥΧΑΣΜΟΎ, Ω ΙΣΧΥΡΉ ΓΥΝΑΊΚΑ, ΆΓΙΑ, ΒΑΣΊΛΙΣΣΑ, ΓΙΑ ΤΗ ΘΑΝΑΤΗΦΌΡΑ ΑΝΕΠΆΡΚΕΙΑ ΜΟΥ ΧΩΡΊΣ ΑΜΦΙΒΟΛΊΑ ΝΑ ΣΑΣ ΚΆΝΕΙ ΓΑΛΉΝΙΟ: ΠΆΝΤΑ ΛΥΠΗΜΈΝΟΣ ΑΠΌ ΤΟΝ ΜΑΡΑΜΈΝΟ ΧΡΌΝΟ, ΤΟΥΛΆΧΙΣΤΟΝ, ΧΑΜΌΓΕΛΟ ΣΤΟΝ ΚΑΤΑΡΑΜΈΝΟ ΓΈΡΟ.
Hi, I tried searching for "CCCB" but it didn't find anything:
Screenshot of the search in Osmin

For comparison, here I did the same search in OSM: https://www.openstreetmap.org/search?query=CCCB
Screenshot of the search in https://www.openstreetmap.org/

I have the version 1.8.7 on the pinephone. I have downloaded the map for spain.
Hi, "CCCB" is probably an alias or alternative name for this location. The embedded database cannot includes all things you could find from an internet server that has terrabytes of data. I tried with "centre de cultura barcelona" and that matches with the location. Also I released the new version 1.9.6, that handles more recent databases (maps version 24 with transliterate option). Upgrading, you will need to download again the maps.