astippich added inline comments. INLINE COMMENTS
> bruns wrote in resulttest.cpp:63 > This looks wrong to me ... > How many items do you get when you append "keyword3" first and ["keyword1", > "keyword2"] next? It's the same. The properties will get merged regardless of their form if the QVariantMap already contains an item with the same key, see https://phabricator.kde.org/source/baloo/browse/master/src/file/extractor/result.cpp$52 so this works as currently intended. Right now, we rely on this behavior because KFileMetaData (incorrectly) outputs multiple properties with the same key instead of a single property made of a QStringList. I wrote the test to prepare the switch to string lists at some point. My favorite solution is to remove this merging, once KFileMetaData outputs string lists when necessary. This requires a custom function for the conversion of the output JSON to a PropertyMap, see https://phabricator.kde.org/source/baloo/browse/master/src/lib/file.cpp$118 QJsonDocument::toVariantMap currently does not handle duplicated keys. IIRC JSON with duplicated keys is strictly not compliant, but since it is only internal, this is okay IMHO. The own conversion function will save us an extra for loop, and makes sure that the same PropertyMap is generated when either querying via Baloo (file.load()) or directly via KFileMetaData's SimpleExtractionResult. REPOSITORY R293 Baloo REVISION DETAIL https://phabricator.kde.org/D17302 To: astippich, #baloo, bruns Cc: kde-frameworks-devel, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams