Use heuristic weighted length algorithm to calculate the query term length.

Authored by xuetianweng on Nov 12 2017, 10:58 AM.

Description

Use heuristic weighted length algorithm to calculate the query term length.

Summary:
Composing CJK character requires a lot more key comparing to latin
characters. The raw length check does not make much sense for query string
in CJK characters. Here we use a simple algorithm to query the character
script property in unicode. If they are belong to CJK, use length 2 instead
of 1 for the character.

Test Plan:
Search "系" (normally requires three key press "x + i + 1" under pinyin) under
zh_CN in krunner and get some result instead of nothing.

Reviewers: hein, broulik

Reviewed By: hein

Subscribers: cfeck, ihipop, plasma-devel

Tags: Plasma

Differential Revision: https://phabricator.kde.org/D8771