summaryrefslogtreecommitdiff
path: root/src/libtracker-fts
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2014-01-15 14:16:05 +0100
committerAleksander Morgado <aleksander@aleksander.es>2014-01-21 12:18:33 +0100
commit8e00e18156328725c03210edb1a7585922c32984 (patch)
treeb142208ed89861f1a476e8366a5f5336a90b0577 /src/libtracker-fts
parentbf12da78b78071735c35ca01d3c8b2b30275119e (diff)
downloadtracker-8e00e18156328725c03210edb1a7585922c32984.tar.gz
libtracker-data: new 'tracker:normalize' method
https://bugzilla.gnome.org/show_bug.cgi?id=722254 This method allows normalizing the strings used in SPARQL queries. It expects two arguments: First, the string to be normalized, and second, one of "nfc", "nfd", "nfkc" or "nfkd" specifying the type of normalization to apply to the string. Example: 1) First, insert a new element which has accents in the nie:title. In the example we insert the word 'école' which in UTF-8 NFC looks like "0xC3 0xA9 0x63 0x6F 0x6C 0x65": $ tracker-sparql -u -q " INSERT { <abc> a nie:InformationElement . <abc> nie:title 'école' }" 2) Second, get hexdump of querying nie:title, we should get the original string in UTF-8 and NFC normalization: $ tracker-sparql -q " SELECT ?title WHERE { <abc> nie:title ?title }" | hexdump 0000000 6552 7573 746c 3a73 200a c320 63a9 6c6f 0000010 0a65 000a 0000013 3) Third, now apply explicitly NFC normalization, we should get the same output: $ tracker-sparql -q " SELECT tracker:normalize(?title,'nfc') WHERE { <abc> nie:title ?title }" | hexdump 0000000 6552 7573 746c 3a73 200a c320 63a9 6c6f 0000010 0a65 000a 0000013 4) Last, apply a NFD decomposition, the expected decomposed string should look like "0×65 0xCC 0x81 0×63 0x6F 0x6C 0×65": $ tracker-sparql -q " SELECT tracker:normalize(?title,'nfkd') WHERE { <abc> nie:title ?title }" | hexdump 0000000 6552 7573 746c 3a73 200a 6520 81cc 6f63 0000010 656c 0a0a 0000014
Diffstat (limited to 'src/libtracker-fts')
0 files changed, 0 insertions, 0 deletions